Skip to content

Commit

Permalink
Add the "examples" keyword.
Browse files Browse the repository at this point in the history
This addresses issue #121.

Most of the wording is lifted from "default", which is similar and can serve
the same purpose.  This wording explicitly allows for using "default" as an
example, without requiring that implementations do so.

The "MAY be used in a root schema or any subschema" line for all of the
meta-data keywords seems to have been a holdover from an earlier approach
of always specifying where keywords could be used.  It is not done anywhere
else and raised a red flag in review of the original version of this
commit, so this version removes it from all meta-data keywords.
  • Loading branch information
handrews committed Nov 17, 2016
1 parent 5340c4b commit 3122553
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions jsonschema-validation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,6 @@
preferably be short, whereas a description will provide explanation about
the purpose of the instance described by this schema.
</t>
<t>
Both of these keywords MAY be used in root schemas, and in any subschemas.
</t>
</section>

<section title='"default"'>
Expand All @@ -680,8 +677,22 @@
particular schema. It is RECOMMENDED that a default value be valid against
the associated schema.
</t>
</section>

<section title='"examples"'>
<t>
The value of this keyword MUST be an array.
There are no restrictions placed on the values within the array.
</t>
<t>
This keyword can be used to provide sample JSON values associated with a
particular schema, for the purpose of illustrating usage. It is
RECOMMENDED that these values be valid against the associated schema.
</t>
<t>
This keyword MAY be used in root schemas, and in any subschemas.
Implementations MAY use the value of "default", if present, as
an additional example. If "examples" is absent, "default"
MAY still be used in this manner.
</t>
</section>

Expand Down

0 comments on commit 3122553

Please sign in to comment.