Skip to content

Standardize format of meta-schemas. #186

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 1 commit into from
Dec 12, 2016
Merged
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
57 changes: 30 additions & 27 deletions hyper-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,46 @@
"$schema": "http://json-schema.org/draft/hyper-schema#",
"id": "http://json-schema.org/draft/hyper-schema#",
"title": "JSON Hyper-Schema",
"allOf": [
{"$ref": "http://json-schema.org/draft-04/schema#"}
],
"allOf": [ { "$ref": "http://json-schema.org/draft/schema#" } ],
"properties": {
"additionalItems": {
"anyOf": [
{"type": "boolean"},
{"$ref": "#"}
{ "type": "boolean" },
{ "$ref": "#" }
]
},
"additionalProperties": {
"anyOf": [
{"type": "boolean"},
{"$ref": "#"}
{ "type": "boolean" },
{ "$ref": "#" }
]
},
"dependencies": {
"additionalProperties": {
"anyOf": [
{"$ref": "#"},
{"type": "array"}
{ "$ref": "#" },
{ "type": "array" }
]
}
},
"items": {
"anyOf": [
{"$ref": "#"},
{"$ref": "#/definitions/schemaArray"}
{ "$ref": "#" },
{ "$ref": "#/definitions/schemaArray" }
]
},
"definitions": {
"additionalProperties": {"$ref": "#"}
"additionalProperties": { "$ref": "#" }
},
"patternProperties": {
"additionalProperties": {"$ref": "#"}
"additionalProperties": { "$ref": "#" }
},
"properties": {
"additionalProperties": {"$ref": "#"}
"additionalProperties": { "$ref": "#" }
},
"allOf": {"$ref": "#/definitions/schemaArray"},
"anyOf": {"$ref": "#/definitions/schemaArray"},
"oneOf": {"$ref": "#/definitions/schemaArray"},
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" },

"base": {
Expand All @@ -52,7 +50,7 @@
},
"links": {
"type": "array",
"items": {"$ref": "#/definitions/linkDescription"}
"items": { "$ref": "#/definitions/linkDescription" }
},
"media": {
"type": "object",
Expand All @@ -66,17 +64,26 @@
"type": "string"
}
}
},
"readOnly": {
Copy link
Member

Choose a reason for hiding this comment

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

I can see readOnly in draft-5 (aka latest), so am happy with this.

"description": "If true, indicates that the value of this property is controlled by the server.",
"type": "boolean",
"default": "false"
}
},
"definitions": {
"schemaArray": {
"type": "array",
"items": {"$ref": "#"}
"allOf": [
{ "$ref": "http://json-schema.org/drafts/schema" },
{
"items": { "$ref": "#" }
}
]
},
"linkDescription": {
"title": "Link Description Object",
"type": "object",
"required": ["href"],
"required": [ "href" ],
"properties": {
"href": {
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
Expand All @@ -92,7 +99,7 @@
},
"targetSchema": {
"description": "JSON Schema describing the link target",
"$ref": "#"
"allOf": [ { "$ref": "#" } ]
},
"mediaType": {
"description": "media type (as defined by RFC 2046) describing the link target",
Expand All @@ -109,7 +116,7 @@
},
"schema": {
"description": "Schema describing the data to submit along with the request",
"$ref": "#"
"allOf": [ { "$ref": "#" } ]
}
}
}
Expand All @@ -118,10 +125,6 @@
{
"rel": "self",
"href": "{+id}"
},
{
"rel": "full",
"href": "{+($ref)}"
}
]
}
42 changes: 42 additions & 0 deletions links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "http://json-schema.org/draft/hyper-schema#",
Copy link
Member

Choose a reason for hiding this comment

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

When the draft 4 version had the URI of draft-4/hyper-schema, why do we not use the URI of draft-5/hyper-schema? (Or will that be a later PR?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this is for "master" so it's not a numbered draft (at least that's how @awwright set it up and I was trying to not change it- take a look at the "id" of the hyper-schema).

"id": "http://json-schema.org/draft/links#",
"title": "Link Description Object",
"type": "object",
"required": [ "href" ],
Copy link
Member

Choose a reason for hiding this comment

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

draft 4 version at https://github.com/json-schema-org/json-schema-org.github.io/blob/master/draft-04/links#L6 includes "rel" as required. Was this changed in draft 4? (Just checking)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it was changed in draft 5. I made those changes later in the sequence for hyper-schema.json but forgot to "backport" links.json to a draft-4-compatible state. I just pulled it over as-is from the draft 5 changes I made on the website. I can change it if preferred.

"properties": {
"href": {
"description": "a URI template, as defined by RFC 6570, with the addition of the $, ( and ) characters for pre-processing",
"type": "string"
},
"rel": {
"description": "relation to the target resource of the link",
"type": "string"
},
"title": {
"description": "a title for the link",
"type": "string"
},
"targetSchema": {
"description": "JSON Schema describing the link target",
"allOf": [ { "$ref": "hyper-schema#" } ]
},
"mediaType": {
"description": "media type (as defined by RFC 2046) describing the link target",
"type": "string"
},
"method": {
"description": "specifies that the client can construct a templated query (\"get\") or non-idempotent request (\"post\") to a resource.",
"type": "string"
},
"encType": {
"description": "The media type in which to submit data along with the request",
"type": "string",
"default": "application/json"
},
"schema": {
"description": "Schema describing the data to submit along with the request",
"allOf": [ { "$ref": "hyper-schema#" } ]
}
}
}
14 changes: 11 additions & 3 deletions schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "http://json-schema.org/draft/schema#",
"$schema": "http://json-schema.org/draft/schema#",
"description": "Core schema meta-schema",
"id": "http://json-schema.org/draft/schema#",
"title": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
Expand All @@ -19,7 +19,15 @@
]
},
"simpleTypes": {
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
"enum": [
"array",
"boolean",
"integer",
"null",
"number",
"object",
"string"
]
},
"stringArray": {
"type": "array",
Expand Down