fix(spec): custom actions documentation does not match the schema - #81
Open
ficosta wants to merge 1 commit into
Open
fix(spec): custom actions documentation does not match the schema#81ficosta wants to merge 1 commit into
ficosta wants to merge 1 commit into
Conversation
Six lines in the custom actions material contradict the JSON schemas: - customActions is described as a Map keyed by action id, but the schema declares an array of Action objects, each carrying its own id - the field is called `actions` in two places; no such Manifest property exists, and additionalProperties is false - the Action `schema` field may also be null, which the field table does not mention - customAction() describes skipAnimation with stopAction()'s wording and its Promise sentence with updateAction()'s Validation claims checked with ajv against v1/specification/json-schemas.
Collaborator
|
Changes look good to me! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These came up while working through the v1 spec for an implementation. Each one is a
place where the prose and the JSON schemas told me different things and I had to go to
the schemas to find out which to follow, so I am reporting them together.
The custom actions documentation does not match the Manifest schema. Two of these
mismatches produce a Manifest that fails validation if the prose is followed
literally; the rest are wording carried over from neighbouring sections.
I checked the two validation claims below with ajv against the schemas in
v1/specification/json-schemas, rather than by reading alone.customActionsis an array, not a mapLine 159 describes the field as "a Map where the keys correspond to the id of the
custom action and the values are
Actionobjects". Ingraphics/schema.json,customActionsis"type": "array"withActionitems, andActiondeclaresidas a required property. Line 70 of this same document already says
Action[], "Anarray of
Actionobjects".A Manifest written in the map form that line 159 describes is rejected with
must be array. The array form validates.The field is named
customActions, notactionsLines 158 and 388 both refer to an
actionsfield. The Manifest has no suchproperty. Its properties are
$schema,id,version,main,name,description,author,customActions,actionDurations,supportsRealTime,supportsNonRealTime,stepCount,schema,renderRequirementsandthumbnails.Since the schema sets
additionalProperties: false, a Manifest that uses the nameactionsis not merely unconventional, it is rejected withmust NOT have additional properties.An Action's
schemamay be nullLine 167 gives the type of the Action
schemafield asobject.lib/action.jsondeclares it as
oneOfan object or null, and its own description says "If the actiondoes not require any parameters, set this to null". The field table does not mention
that, so a reader working from the table would not know the null case exists.
I put the null case in the description column rather than the type column, because
every other type cell in this document is a bare type name and the document never
escapes a pipe inside a table. If you would rather the type column carried it, say so
and I will change it there instead.
Two lines in
customAction()describe a different actionEach action section describes
skipAnimationwith the verb of its own action:"transition" for
playAction()at line 297, "disappear" forstopAction()at line346, "update" for
updateAction()at line 368. Line 392 givescustomAction()thestopAction()wording, "should disappear", which does not describe an arbitrarycustom action.
Line 396 reads "The returned Promise MUST resolve after the execution of the update",
matching
updateAction()at line 372. The next paragraph of the same section, at line398, was already adapted to "an animation of the action", which suggests a line was
missed rather than an intentional cross-reference.
What changed
Six lines, all in the custom actions material.
actionsbecomescustomActionsinboth places, the map description becomes an array description, the Action
schemarow gains the null case, "should disappear" becomes "should perform the action", and
"the execution of the update" becomes "the execution of the action". No other section
is touched.
Left alone
Lines 389 and 390 already require the Promise to "resolve when the action is
executed", so line 396 restates the same rule. Removing that duplication is an
editorial decision rather than a correction, and it overlaps with the ground the
fix/specification-actionsbranch was covering, so I have left it as it stands.Related
The same pass through the spec produced two other things, listed here in case it is
easier to look at them together:
schemafield description, which names a method that doesnot exist and omits
load().permission to validate
params.data, or would rather stay silent on that and onlycover what happens when data does not conform.
This is the last of the three, so nothing further is queued behind it.