Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-FMEDIT-016

The host refuses a value that breaks YAML, the field type or the schema, and ignores a malformed save message

When the host receives a frontmatter save whose YAML value does not parse or is empty, or whose value does not fit the field type or the schema, the extension SHALL refuse it with "Invalid YAML value: {parser message}" for a YAML value and with the matching message otherwise, and change nothing; a previewFrontmatterSave message that does not name a non-empty editId and fieldName, or that carries a field outside its accepted shape, is ignored without a reply.

Another outcome at step 2 of path 1 in StRS-MDOKFSTUDIO-FMEDIT-001, in the state “A field editor is open”.

Another outcome at step 1 of path 1 in StRS-MDOKFSTUDIO-FMEDIT-008, in the state “A field editor is open”.

Scenarios 11

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

nominalA YAML value that does not parse is refused
Givena save with fieldValueFormat yaml and the text [
Whenthe host plans the save
Thenthe answer is the error "Invalid YAML value: " followed by the parser message and the document is unchanged
refusalAn empty or non-text YAML value
Save with fieldValueFormat yamlAnswer
an empty or blank text"Invalid YAML value: Enter a YAML value."
a non-text payload"The YAML field value must be text."

A save with the flush flag skips the parse refusal and keeps the typed text (see SwRS-MDOKFSTUDIO-FMEDIT-067).

refusalA value that does not fit the field type
Save received for a schema fieldAnswer (the document is unchanged)
null for a field that is not nullable"The frontmatter field is stale or its value does not match the schema."
paused for an enum field with the values draft and activethe same stale-field message
a text, date or time that is not a string; a boolean field that is not a boolean; a number that is not finite; a list that is not an arraythe same stale-field message
boundaryValues that are accepted
SaveOutcome
null for a nullable schema fieldaccepted
any value for a document without a schemano type check applies and the value is written
refusalA schema error on the edited field
Save receivedAnswer (the document is unchanged)
a value that violates a constraint of the schema field"Schema validation failed: " followed by the schema message
null for a nullable field that a conditional (if/then) rule requires to be set"Schema validation failed: " followed by the schema message
a rename after which the field cannot be found in the re-analysis"The renamed frontmatter field could not be validated."
null for a field whose conditional (if/then) rule does not apply because the condition is not metnot refused: the same null save is accepted and written
boundaryOnly errors of the edited field block a save
SituationOutcome
the only error of the edited field is a broken linkthe save is accepted
another field of the frontmatter has a schema error and a different field is edited with a valid valuethe save is accepted
refusalA save for a missing field or revision is stale
Save receivedAnswer (the document is unchanged)
a field name absent from the current analysis"The frontmatter field is stale or its value does not match the schema."
a document revision that differs from the revision of the documentthe same stale-field message
an add of a name that already existsthe same stale-field message
nominalA frontmatter save that names its editor and field is accepted
previewFrontmatterSave messageOutcome
editId e1 and fieldName status (with its fieldValue)accepted
frontmatterAction add, afterField status and newFieldName owneraccepted

The envelope, the size bound and the pin fields (pinLine, pinViewportTop) are checked once for all page messages (see SwRS-MDOKFSTUDIO-TRUST-052).

refusalA save that does not name its editor, field or value is ignored
previewFrontmatterSave messageOutcome
without fieldName, or with an empty fieldNamerefused: nothing is replied and the document is unchanged
without editId, or with an empty editIdrefused: nothing is replied and the document is unchanged
without fieldValue, unless frontmatterAction is removerefused: nothing is replied and the document is unchanged
with fieldValueFormat other than yamlrefused: nothing is replied and the document is unchanged
boundaryAccepted bounds of the optional fields
FieldAccepted shape
afterFielda string of 1 to 1024 characters without a line break, only with frontmatterAction add; an add whose afterField contains a line break, or a remove with afterField, is dropped and the document is unchanged
frontmatterActionadd or remove
fieldValueFormatyaml
fieldValueStyleplain, and only with no frontmatterAction and no fieldValueFormat
flushtrue
newFieldNamea string
refusalThe frontmatter-save fields are accepted only on a frontmatter save
Givena previewScroll message with newFieldName owner (or any other message type that carries fieldValueFormat, fieldValueStyle, newFieldName, afterField or frontmatterAction)
Whenit is checked
Thenit is refused

Implemented in 2

Tested by 3

Known limits (1)

Replaces

SwRS-MDOKFSTUDIO-FMEDIT-018A null value is refused for a field that is not nullable superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-016 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-047A value that does not fit the field type is refused superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-016 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-048A schema error on the edited field refuses the save superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-016 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-049Only errors of the edited field block a save superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-016 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-054A frontmatter save message names its editor and field, or is ignored superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-016 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-079A null value is refused when a conditional rule forbids it superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-016 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-083A save for a missing field or revision is refused as stale superseded superseded by SwRS-MDOKFSTUDIO-FMEDIT-016 Markdown file