Skip to content

Add namedExamples #1114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@
of any vocabulary, there is no analogous mechanism to indicate individual
keyword usage.
</t>
<t>
A schema vocabulary can be defined by anything from an informal description
to a standards proposal, depending on the audience and interoperability
expectations. In particular, in order to facilitate vocabulary use within
non-public organizations, a vocabulary specification need not be published
outside of its scope of use.
</t>
</section>
<section title="Meta-Schemas">
<t>
Expand Down Expand Up @@ -2061,13 +2068,6 @@
The current URI for the corresponding meta-schema is:
<eref target="https://json-schema.org/draft/2020-12/meta/applicator"/>.
</t>
<t>
Updated vocabulary and meta-schema URIs MAY be published between
specification drafts in order to correct errors. Implementations
SHOULD consider URIs dated after this specification draft and
before the next to indicate the same syntax and semantics
as those listed here.
</t>
<section title="Keyword Independence">
<t>
Schema keywords typically operate independently, without
Expand Down Expand Up @@ -2497,13 +2497,6 @@
The current URI for the corresponding meta-schema is:
<eref target="https://json-schema.org/draft/2020-12/meta/unevaluated"/>.
</t>
<t>
Updated vocabulary and meta-schema URIs MAY be published between
specification drafts in order to correct errors. Implementations
SHOULD consider URIs dated after this specification draft and
before the next to indicate the same syntax and semantics
as those listed here.
</t>

<section title="Keyword Independence">
<t>
Expand Down
18 changes: 18 additions & 0 deletions jsonschema-validation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,24 @@
an additional example. If "examples" is absent, "default"
MAY still be used in this manner.
</t>
<t>
Implementations MAY use the values of "namedExamples", if present, as
additional examples. If "examples" is absent, "namedExamples"
MAY still be used in this manner.
</t>
</section>

<section title='"namedExamples"'>
<t>
The value of this keyword MUST be an object.
There are no restrictions placed on the values within the object.
</t>
<t>
This keyword can be used to provide named sample JSON values associated with a
particular schema, for the purpose of illustrating usage, and to make them
available for referencing outside of the schema. It is RECOMMENDED that these
values be valid against the associated schema.
</t>
</section>
</section>

Expand Down
3 changes: 3 additions & 0 deletions meta/meta-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"examples": {
"type": "array",
"items": true
},
"namedExamples": {
"type": "object"
}
}
}