Behaviour SwRS-MDOKFSTUDIO-FMSCHEMA-029
A schema table lists the declared fields with their type
When a document's type has a schema, the extension SHALL show a table with the columns Name, Value and Description that lists the declared fields present in the document in schema order, then the other keys in source order, each with a type icon and label before its name, a tooltip on its row, and the properties of composed schemas merged into one field list.
Step 1 of path 1 in StRS-MDOKFSTUDIO-FMSCHEMA-010: from “The type of the document has a schema” to “The fields are listed in schema order”.
Scenarios 7
The situations the tests check; open one to read it.
nominalSchema order
Givena schema declaring type, title and owner (in that order) and a document writing type, owner, title and an extra key zz
Whenthe preview is rendered
Thenthe rows read type, title, owner, zz and the Description column shows each schema description
boundaryRequired but absent field
Giventhe same schema requiring a field that the document lacks
Whenthe preview is rendered
Thenan empty row for the field is appended after the other rows
nominalType icon and label
Givena schema table with a boolean field
Whenthe preview is rendered
Thenthe name cell holds, before the name, the checkbox icon titled Checkbox (at most 1.5 em) and, after the name, the label (boolean)
boundaryDisplayed field type
| Input | Outcome |
|---|---|
| a field of type boolean, integer, array, or string with format date-time, or an enum | the labels read boolean, number, list, datetime and enum |
| a field with a format date, date-time or time | the label reads date, datetime or time (the format test comes before the type test) |
| a type list | the first non-null type is used |
| a field declared as type object, a field declared only by anyOf, or a field with no usable type declaration | labelled (unknown), with the icon titled Unknown type |
| a field with enum or const | labelled enum |
nominalRow tooltip
Givena field with title Status, description Lifecycle and enum draft and active
Whenthe preview is rendered
Thenthe row tooltip reads Status, Lifecycle and Allowed: draft, active on separate lines
the same field holding the value retired ends the tooltip with the validation message of the enum
the same field holding the value retired ends the tooltip with the validation message of the enum
boundaryComposed schemas
| Input | Outcome |
|---|---|
| a schema with allOf adding x (required), and if kind is a then ifa (required) else ifb, and a document with kind a | the missing required fields are x and ifa |
| the same document with kind b | the missing required fields are only x, because the then branch is not visited |
refusalNames equal to object members
| Input | Outcome |
|---|---|
| a schema declaring and requiring toString and a document with a key constructor | constructor is an undeclared key and toString is reported as a missing required field |
| a schema that really declares constructor and a document that sets it | constructor is a declared present field |
Implemented in 2
Tested by 4
Known limits (2)
- anyOf and oneOf branches are merged even when they do not match the values (display only; validation is the validator's).
- fields declared with type object are labelled (unknown).
Replaces
SwRS-MDOKFSTUDIO-FMSCHEMA-030Field names show a type icon and a type label superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-029 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-031The row tooltip lists title, description, allowed values and issues superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-029 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-032Composed schemas are merged into one field list superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-029 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-033The displayed field type follows the schema declaration superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-029 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-034Field names equal to object members are not treated as present superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-029 Markdown file