Skip to content
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

Add "$ref", numeric exclusive*, default empty string arrays to meta-schemas, standardize meta-schema formats #168

Closed
wants to merge 4 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
151 changes: 83 additions & 68 deletions hyper-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,117 @@
"$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#"}
],
"definitions": {
"schemaArray": {
"allOf": [
{ "$ref": "http://json-schema.org/drafts/schema" },
{
"items": { "$ref": "#/definitions/subSchema" }
}
]
},
"linkDescription": {
"title": "Link Description Object",
"type": "object",
"required": [ "href" ],
"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": "#/definitions/subSchema" } ]
},
"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": "#/definitions/subSchema" } ]
}
}
},
"subSchema": {
"oneOf": [
{
"allOf": [
{ "$ref": "#" },
{ "$ref": "http://json-schema.org/draft/schema#/definitions/notJsonReference" }
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this ref be a realative pointer? We wouldn't want to make this version of the meta-schema possible to be invalid by a change at a later date.

Copy link
Member

Choose a reason for hiding this comment

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

Same for line 62

Copy link
Contributor Author

Choose a reason for hiding this comment

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

References to the main schema have never been relative (see the Draft 4 schema) and I'd rather not change that as part of this PR. I'm trying to do the minimal changes here.

Copy link
Member

Choose a reason for hiding this comment

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

Right, that makes sense. Should be logged that it should be fixed though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Logged #182 (boolean schemas, because #167 went in without meta-schema change because I thought this would go in first) and #138 (for the relative reference thing).

]
},
{ "$ref": "http://json-schema.org/draft/schema#/definitions/jsonReference" }
]
}
},

"allOf": [ { "$ref": "http://json-schema.org/draft/schema#" } ],
"properties": {
"additionalItems": {
"anyOf": [
{"type": "boolean"},
{"$ref": "#"}
{ "type": "boolean" },
{ "$ref": "#/definitions/subSchema" }
]
},
"additionalProperties": {
"anyOf": [
{"type": "boolean"},
{"$ref": "#"}
{ "type": "boolean" },
{ "$ref": "#/definitions/subSchema" }
]
},
"dependencies": {
"additionalProperties": {
"anyOf": [
{"$ref": "#"},
{"type": "array"}
{ "$ref": "#/definitions/subSchema" },
{ "type": "array" }
]
}
},
"items": {
"anyOf": [
{"$ref": "#"},
{"$ref": "#/definitions/schemaArray"}
{ "$ref": "#/definitions/subSchema" },
{ "$ref": "#/definitions/schemaArray" }
]
},
"definitions": {
"additionalProperties": {"$ref": "#"}
"additionalProperties": { "$ref": "#/definitions/subSchema" }
},
"patternProperties": {
"additionalProperties": {"$ref": "#"}
"additionalProperties": { "$ref": "#/definitions/subSchema" }
},
"properties": {
"additionalProperties": {"$ref": "#"}
"additionalProperties": { "$ref": "#/definitions/subSchema" }
},
"allOf": {"$ref": "#/definitions/schemaArray"},
"anyOf": {"$ref": "#/definitions/schemaArray"},
"oneOf": {"$ref": "#/definitions/schemaArray"},
"not": { "$ref": "#" },
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#/definitions/subSchema" },

"base": {
"description": "URI Template resolved as for the 'href' keyword in the Link Description Object. The resulting URI Reference is resolved against the current URI base and sets the new URI base for URI references within the instance.",
"type": "string"
},
"links": {
"type": "array",
"items": {"$ref": "#/definitions/linkDescription"}
"items": { "$ref": "#/definitions/linkDescription" }
},
"media": {
"type": "object",
Expand All @@ -66,62 +126,17 @@
"type": "string"
}
}
}
},
"definitions": {
"schemaArray": {
"type": "array",
"items": {"$ref": "#"}
},
"linkDescription": {
"title": "Link Description Object",
"type": "object",
"required": ["href"],
"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",
"$ref": "#"
},
"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",
"$ref": "#"
}
}
"readOnly": {
"description": "If true, indicates that the value of this property is controlled by the server.",
"type": "boolean",
"default": "false"
}
},
"links": [
{
"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#",
"id": "http://json-schema.org/draft/links#",
"title": "Link Description Object",
"type": "object",
"required": [ "href" ],
"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#" } ]
}
}
}
Loading