Skip to content

Identify vocabularies, update meta-schemas #714

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

Merged
merged 3 commits into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
30 changes: 15 additions & 15 deletions hyper-schema.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
"$id": "http://json-schema.org/draft-08/hyper-schema",
"$schema": "http://json-schema.org/draft/2019-03/hyper-schema#",
"$id": "http://json-schema.org/draft/2019-03/hyper-schema",
"$vocabulary": {
"https://json-schema.org/draft/2019/03/vocab/core": true,
"https://json-schema.org/draft/2019/03/vocab/applicator": true,
"https://json-schema.org/draft/2019/03/vocab/validation": true,
"https://json-schema.org/draft/2019/03/vocab/meta-data": true,
"https://json-schema.org/draft/2019/03/vocab/format": true,
"https://json-schema.org/draft/2019/03/vocab/content": true,
"https://json-schema.org/draft/2019/03/vocab/hyper-schema": true
},
"$recursiveAnchor": true,

"title": "JSON Hyper-Schema",
"$ref": "http://json-schema.org/draft-08/schema",
"properties": {
"base": {
"type": "string",
"format": "uri-template"
},
"links": {
"type": "array",
"items": {
"$ref": "http://json-schema.org/draft-08/links"
}
}
},
"allOf": [
{"$ref": "http://json-schema.org/draft/2019-03/schema"},
{"$ref": "http://json-schema.org/draft/2019-03/meta/hyper-schema"}
],
"links": [
{
"rel": "self",
Expand Down
63 changes: 39 additions & 24 deletions jsonschema-core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1058,11 +1058,18 @@
</t>
<t>
The current URI for the Core vocabulary is:
<eref target="https://json-schema.org/draft-08/vocabularies/core"/>.
<eref target="https://json-schema.org/draft/2019-03/vocab/core"/>.
</t>
<t>
The current URI for the corresponding meta-schema is:
<eref target="https://json-schema.org/draft-08/core"/>.
<eref target="https://json-schema.org/draft/2019/03/meta/core"/>.
</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>
<section title="Example Meta-Schema With Vocabulary Declarations"
Expand All @@ -1081,16 +1088,16 @@
<artwork>
<![CDATA[
{
"$schema": "https://json-schema.org/draft-08/core-app-example#",
"$id": "https://json-schema.org/draft-08/core-app-example",
"$schema": "https://json-schema.org/draft/2019-03/core-app-example#",
"$id": "https://json-schema.org/draft/2019-03/core-app-example",
"$recursiveAnchor": true,
"$vocabulary": {
"https://json-schema.org/draft-08/vocabularies/core": true,
"https://json-schema.org/draft-08/vocabularies/applicator": true
"https://json-schema.org/draft/2019-03/vocab/core": true,
"https://json-schema.org/draft/2019-03/vocab/applicator": true
},
"allOf": [
{"$ref": "https://json-schema.org/draft-08/core"},
{"$ref": "https://json-schema.org/draft-08/applicator"}
{"$ref": "https://json-schema.org/draft/2019-03/meta/core"},
{"$ref": "https://json-schema.org/draft/2019-03/meta/applicator"}
],
"patternProperties": {
"^unevaluated.*$": false
Expand Down Expand Up @@ -1352,7 +1359,7 @@
<artwork>
<![CDATA[
{
"$schema": "http://json-schema.org/draft-08/schema#",
"$schema": "http://json-schema.org/draft/2019-03/schema#",
"$id": "https://example.com/original",

"properties": {
Expand All @@ -1366,7 +1373,7 @@
}

{
"$schema": "http://json-schema.org/draft-08/schema#",
"$schema": "http://json-schema.org/draft/2019-03/schema#",
"$id": "https://example.com/extension",

"$ref": "original",
Expand Down Expand Up @@ -1465,7 +1472,7 @@
<artwork>
<![CDATA[
{
"$schema": "http://json-schema.org/draft-08/schema#",
"$schema": "http://json-schema.org/draft/2019-03/schema#",
"$id": "https://example.com/original",
"$recursiveAnchor": true,

Expand All @@ -1480,7 +1487,7 @@
}

{
"$schema": "http://json-schema.org/draft-08/schema#",
"$schema": "http://json-schema.org/draft/2019-03/schema#",
"$id": "https://example.com/extension",
"$recursiveAnchor": true,

Expand Down Expand Up @@ -1881,17 +1888,24 @@
This section defines a vocabulary of applicator keywords that
are RECOMMENDED for use as the basis of other vocabularies.
</t>
<t>
Meta-schemas that do not use "$vocabulary" SHOULD be considered to
require this vocabulary as if its URI were present with a value of true.
</t>
<t>
The current URI for this vocabulary, known as the Applicator vocabulary, is:
<eref target="https://json-schema.org/draft-08/vocabularies/applicator"/>.
<eref target="https://json-schema.org/draft/2019-03/vocab/applicator"/>.
</t>
<t>
The current URI for the corresponding meta-schema is:
<eref target="https://json-schema.org/draft-08/applicator"/>.
<eref target="https://json-schema.org/draft/2019-03/meta/applicator"/>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not in this PR, but should we have language identifying this vocab/meta arrangement as a suggested pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly- definitely not in this PR but it's an interesting idea. Might be better in a best practices section on the site or understanding JSON Schema? Not sure- feel free to file it as an issue on the spec repo if you want.

</t>
<t>
Meta-schemas that do not use "$vocabulary" SHOULD be considered to
require this vocabulary as if its URI were present with a value of true.
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 Expand Up @@ -2479,7 +2493,7 @@
<figure>
<artwork>
<![CDATA[
http://json-schema.org/draft-08/schema#/$defs/nonNegativeInteger/minimum
http://json-schema.org/draft/2019-03/schema#/$defs/nonNegativeInteger/minimum
]]>
</artwork>
</figure>
Expand Down Expand Up @@ -2555,7 +2569,7 @@ http://json-schema.org/draft-08/schema#/$defs/nonNegativeInteger/minimum
<![CDATA[
{
"$id": "http://example.com/polygon#",
"$schema": "http://json-schema.org/draft-08/schema#",
"$schema": "http://json-schema.org/draft/2019-03/schema#",
"$defs": {
"point": {
"type": "object",
Expand Down Expand Up @@ -2766,16 +2780,16 @@ http://json-schema.org/draft-08/schema#/$defs/nonNegativeInteger/minimum
</t>
<t>
Because this output structure can be quite large, a smaller example is given
here for brevity. The full output structure of the example above can be found
<eref target="standardized-output-verbose.json">here</eref>.
here for brevity. The URI of the full output structure of the example above is:
<eref target="https://json-schema.org/draft/2019-03/output/verbose-example"/>.
</t>
<figure>
<artwork>
<![CDATA[
// schema
{
"$id": "http://example.com/polygon#",
"$schema": "http://json-schema.org/draft-08/schema#",
"$schema": "http://json-schema.org/draft/2019-03/schema#",
"type": "object",
"properties": {
"validProp": true,
Expand Down Expand Up @@ -2825,10 +2839,11 @@ http://json-schema.org/draft-08/schema#/$defs/nonNegativeInteger/minimum
</figure>
</section>

<section title="Output validation schema">
<section title="Output validation schemas">
<t>
For convenience, a JSON Schema has been provided to validate output generated
by implementations. It can be found <eref target="schema-output.json">here</eref>.
For convenience, JSON Schema has been provided to validate output generated
by implementations. Its URI is:
<eref target="https://json-schema.org/draft/2019-03/output/schema"/>.
</t>
</section>

Expand Down
35 changes: 26 additions & 9 deletions jsonschema-hyperschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,24 @@
<section title="Meta-Schemas and Output Schema">
<t>
The current URI for the JSON Hyper-Schema meta-schema is
<eref target="http://json-schema.org/draft-08/hyper-schema#"/>.
<eref target="http://json-schema.org/draft/2019-03/hyper-schema#"/>.
</t>
<t>
The current URI for this vocabulary, known as the Hyper-Schema vocabulary, is:
<eref target="https://json-schema.org/draft/2019-03/vocab/hyper-schema"/>.
</t>
<t>
The current URI for the corresponding meta-schema, which differs from the
convenience meta-schema above in that it describes only the hyper-schema
keywords ("base" and "link") is:
<eref target="https://json-schema.org/draft/2019-03/meta/hyper-schema"/>.
</t>
<t>
The <xref target="ldo">link description format</xref> can be used without JSON
Schema, and use of this format can be declared by referencing the normative
link description schema as the schema for the data structure that uses the links.
The URI of the normative link description schema is:
<eref target="http://json-schema.org/draft-08/links#"/>.
<eref target="http://json-schema.org/draft/2019-03/links#"/>.
</t>
<t>
JSON Hyper-Schema implementations are free to provide output in any format.
Expand All @@ -306,7 +316,14 @@
It is RECOMMENDED that implementations be capable of producing output
in this format to facilitated testing. The URI of the JSON Schema
describing the recommended output format is
<eref target="http://json-schema.org/draft-08/hyper-schema-output#"/>.
<eref target="http://json-schema.org/draft/2019-03/output/hyper-schema#"/>.
</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>
<section title="Schema Keywords">
Expand Down Expand Up @@ -1607,7 +1624,7 @@ Link: <https://schema.example.com/entry>; rel="describedBy"
<![CDATA[
{
"$id": "https://schema.example.com/entry",
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
"$schema": "http://json-schema.org/draft/2019-03/hyper-schema#",
"base": "https://example.com/api/",
"links": [
{
Expand Down Expand Up @@ -1681,7 +1698,7 @@ Link: <https://schema.example.com/entry>; rel="describedBy"
<artwork>
<![CDATA[{
"$id": "https://schema.example.com/thing",
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
"$schema": "http://json-schema.org/draft/2019-03/hyper-schema#",
"base": "https://example.com/api/",
"type": "object",
"required": ["data"],
Expand Down Expand Up @@ -1797,7 +1814,7 @@ Link: <https://schema.example.com/entry>; rel="describedBy"
<artwork>
<![CDATA[{
"$id": "https://schema.example.com/interesting-stuff",
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
"$schema": "http://json-schema.org/draft/2019-03/hyper-schema#",
"required": ["stuffWorthEmailingAbout", "email", "title"],
"properties": {
"title": {
Expand Down Expand Up @@ -1984,7 +2001,7 @@ Link: <https://example.com/api/trees/1/nodes/456>; rev="up"
<artwork>
<![CDATA[{
"$id": "https://schema.example.com/tree-node",
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
"$schema": "http://json-schema.org/draft/2019-03/hyper-schema#",
"base": "trees/{treeId}/",
"properties": {
"id": {"type": "integer"},
Expand Down Expand Up @@ -2046,7 +2063,7 @@ Link: <https://example.com/api/trees/1/nodes/456>; rev="up"
<artwork>
<![CDATA[{
"$id": "https://schema.example.com/thing",
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
"$schema": "http://json-schema.org/draft/2019-03/hyper-schema#",
"base": "https://example.com/api/",
"type": "object",
"required": ["data"],
Expand Down Expand Up @@ -2099,7 +2116,7 @@ Link: <https://example.com/api/trees/1/nodes/456>; rev="up"
<artwork>
<![CDATA[{
"$id": "https://schema.example.com/thing-collection",
"$schema": "http://json-schema.org/draft-08/hyper-schema#",
"$schema": "http://json-schema.org/draft/2019-03/hyper-schema#",
"base": "https://example.com/api/",
"type": "object",
"required": ["elements"],
Expand Down
Loading