Expand description
A form generated from a description of the arguments a call takes.
§Why there is a schema type here
For the same reason JsonValue exists: this crate
takes no serialization dependency, so it cannot read a schema document. A
host converts whatever schema dialect it already parses into Schema,
which describes only what a form has to draw — a name, a label, whether the
value is required, and which control the value is edited with.
§A field the form cannot draw says so
This is the rule the whole component is built around. A host converting a
schema it does not fully understand puts
SchemaKind::Unrenderable in place of the field, with the reason in its
own words; the form also refuses a few shapes on its own, such as a choice
among no choices. Either way the field keeps its place, keeps its label,
and states that it cannot be filled in here — and
SchemaForm::values still reports it, as
FieldValue::Unrenderable, so a caller cannot collect the answers and
not notice one is missing.
A form that quietly dropped a required argument it did not understand would produce an invalid call, and the reader would be told they got it wrong.
§Whose error is on screen
Two sources, kept apart. SchemaForm::validate marks required fields
nobody filled in, which is all this component can judge on its own;
SchemaForm::set_error shows an error the host returned, in the host’s
own words. A host error outranks a derived one on the same field, because
the host knows something the form does not.
Structs§
- Number
Bounds - What a number may be, as far as the schema said.
- Schema
- The arguments a call takes, in the order they should be filled in.
- Schema
Choice - One option a closed or open choice offers.
- Schema
Field - One argument.
- Schema
Form - A form built from a schema.
- Unrenderable
Field - A field that has to be filled in somewhere other than this form.
Enums§
- Field
Value - What one field currently holds.
- Schema
Form Event - What the form reports.
- Schema
Kind - What a value is, and therefore which control edits it.