Description
[EDIT: I changed it from "comment"
to "$comment"
as explained in a later... um... comment]
JSON lacks comments. Comments in complex schemas are good. The "description"
keyword, as a general annotation feature that is noted as being usable in interface display is not suitable for schema author-to-schema author comments.
Let's reserve "$comment"
as a keyword.
Implementations MUST NOT use "$comment"
in any sort of end user data presentation.
Implementations MAY choose to use the value of "$comment"
in debugging messages. Similar, schema editing tools MAY make use of or encourage the use of the comment keyword.
Implementations MAY opt to not store the comment field and its value in memory as an optimization.
There is no restriction on the comment's value. While a string is the most obvious sort of comment, schema authors may decide to format comments in any way they wish. Implementations that use comments for debugging or other purposes SHOULD support strings. Schema authors inventing more complex comment forms MUST NOT assume that peer implementations will be able to understand those forms.
"$comment"
would also be legal within a "$ref"
object, and an implementation would still be able to use it for debugging. All other keywords would still be in the "MUST be ignored" category should they appear in a "$ref"
object.
[EDIT: originally this suggested the validation spec but as noted below it really belongs in core if we have it at all]
As an obvious use case, the reviews around "jsonReference" and "notJsonReference" in the meta-schema would have been much easier if a comment field is allowed.