From 31225538fe0bc423cfe0ce5b88006edce690b1df Mon Sep 17 00:00:00 2001 From: Henry Andrews Date: Wed, 2 Nov 2016 17:31:00 -0700 Subject: [PATCH] Add the "examples" keyword. 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. --- jsonschema-validation.xml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/jsonschema-validation.xml b/jsonschema-validation.xml index 817a9410..f2934414 100644 --- a/jsonschema-validation.xml +++ b/jsonschema-validation.xml @@ -666,9 +666,6 @@ preferably be short, whereas a description will provide explanation about the purpose of the instance described by this schema. - - Both of these keywords MAY be used in root schemas, and in any subschemas. -
@@ -680,8 +677,22 @@ particular schema. It is RECOMMENDED that a default value be valid against the associated schema. +
+ +
+ + The value of this keyword MUST be an array. + There are no restrictions placed on the values within the array. + + + 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. + - 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.