Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-FMSCHEMA-084

Every schema violation is reported on its field or in a row of its own

When the frontmatter is validated against its schema, the extension SHALL apply the keywords of JSON Schema 2020-12 with formats and report every violation, on the row of the field concerned when it names one and in a row of its own otherwise.

Step 2 of path 1 in StRS-MDOKFSTUDIO-FMSCHEMA-010: from “The fields are listed in schema order” to “Violations are marked on their field rows”.

Scenarios 7

The situations the tests check; open one to read it.

nominalViolations mark their field rows
Givena schema with a number maximum 5 and a date-time format, and a document with values 9 and x for those fields
Whenthe preview is rendered
Thenboth rows are underlined in red, every violation is reported (not only the first) and their tooltips read must be <= 5 and must match format "date-time"
nominal2020-12 keywords and formats
InputOutcome
a schema using prefixItems with items false and a list value whose second item has the wrong typethe list row carries the error must be number
a schema property with a format and a value that does not match itthe row carries the format error
nominalMissing required field
Givena schema requiring title and a document without title
Whenthe preview is rendered
Thena row named title with an empty value is listed last and carries the error Required field "title" is missing.
nominalWhole-document error
Givena schema with minProperties 3 and a document with the single key type
Whenthe preview is rendered
Thena red row reads must NOT have fewer than 3 properties and the badge reads 1 error
nominalClosed schema
Givena schema with additionalProperties false declaring type and a, and a document that also sets zz
Whenthe preview is rendered
Thenone error row reads must NOT have additional properties, whatever the strict setting
the properties section carries data-okf-additional-properties="false"
nominalStrict setting
Given`markdownOkfSchemaStudio.frontmatter.strictAdditionalProperties` true, a schema declaring type and title, and a document that also sets titel
Whenthe preview is rendered
Thenthe row titel carries the warning "Unknown field; it is not declared in the "{type}" schema." and the badge counts one warning
boundaryCases without an issue
InputOutcome
a schema with a number maximum 5 and a date-time format, and values 3 and 2026-01-01T00:00:00Zno row is underlined and no badge is shown
a document violating one constraintexactly one row carries an error
a schema requiring title and a document with a titleno row carries a required-field error
a schema with minProperties 3 and a document with three keysno whole-document row is shown
a schema without additionalProperties falseno "must NOT have additional properties" row appears
a schema root that allows additional properties, or one that does not state itthe properties section has no data-okf-additional-properties attribute
strictAdditionalProperties unset (default false, boolean)titel is listed without any warning

Implemented in 4

Tested by 5

Known limits (2)

Replaces

SwRS-MDOKFSTUDIO-FMEDIT-086A closed schema flags the properties section superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-084 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-035A schema error marks the row of its field superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-084 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-036A missing required field gets an empty row with its error superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-084 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-037An error that names no field becomes a red row of its own superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-084 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-041A closed schema reports every undeclared field superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-084 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-042The strict setting warns on undeclared fields superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-084 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-089Every violation of the schema is reported superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-084 Markdown file