-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
please see / should fix json-api#867 json-api#851 partially fixes json-api#406 ---> see my following answer in json-api#867 regarding versioning
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"id": "http://jsonapi.org/schemas/create.json", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sebilasse
|
||
"title": "JSON API Schema", | ||
"description": "This is a schema for creating (e.g. via POST) in the JSON API format. For more, see http://jsonapi.org", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/create" | ||
} | ||
], | ||
|
||
"definitions": { | ||
"create": { | ||
"allOf": [ | ||
{ | ||
"$ref": "http://jsonapi.org/schemas/request.json#/definitions/request" | ||
This comment has been minimized.
Sorry, something went wrong.
eneuhauser
|
||
}, | ||
{ | ||
"properties": { | ||
"data": { | ||
"$ref": "#/definitions/data" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"data": { | ||
"description": "The document's \"primary data\" is a representation of the resource or collection of resources targeted by a request.", | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/resource" | ||
}, | ||
{ | ||
"description": "An array of resource objects, an array of resource identifier objects, or an empty array ([]), for requests that target resource collections.", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/resource" | ||
}, | ||
"uniqueItems": true | ||
} | ||
] | ||
}, | ||
"resource": { | ||
"description": "\"Resource objects\" appear in a JSON API document to represent resources. Ids are required, except on the creation request.", | ||
"type": "object", | ||
"required": [ | ||
"type" | ||
], | ||
"properties": { | ||
"type": { | ||
"type": "string" | ||
}, | ||
"id": { | ||
"type": "string" | ||
}, | ||
"attributes": { | ||
"$ref": "http://jsonapi.org/schemas/request.json#/definitions/attributes" | ||
}, | ||
"relationships": { | ||
"$ref": "http://jsonapi.org/schemas/request.json#/definitions/relationships" | ||
}, | ||
"links": { | ||
"$ref": "http://jsonapi.org/schemas/request.json#/definitions/links" | ||
}, | ||
"meta": { | ||
"$ref": "http://jsonapi.org/schemas/response.json#/definitions/meta" | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"id": "http://jsonapi.org/schemas/request.json", | ||
"title": "JSON API Schema", | ||
"description": "This is the base schema for the JSON API format. For more, see http://jsonapi.org", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/request" | ||
} | ||
], | ||
|
||
"definitions": { | ||
"request": { | ||
"type": "object", | ||
"required": [ | ||
"data" | ||
], | ||
"properties": { | ||
"data": { | ||
"$ref": "#/definitions/data" | ||
}, | ||
"included": { | ||
"description": "To reduce the number of HTTP requests, servers **MAY** allow responses that include related resources along with the requested primary resources. Such responses are called \"compound documents\".", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/resource" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
"meta": { | ||
"$ref": "http://jsonapi.org/schemas/response.json#/definitions/meta" | ||
This comment has been minimized.
Sorry, something went wrong.
eneuhauser
|
||
}, | ||
"links": { | ||
"description": "Link members related to the primary data.", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/links" | ||
}, | ||
{ | ||
"$ref": "http://jsonapi.org/schemas/response.json#/definitions/pagination" | ||
} | ||
] | ||
}, | ||
"jsonapi": { | ||
"$ref": "http://jsonapi.org/schemas/response.json#/definitions/jsonapi" | ||
} | ||
} | ||
}, | ||
|
||
"data": { | ||
"description": "The document's \"primary data\" is a representation of the resource or collection of resources targeted by a request.", | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/resource" | ||
}, | ||
{ | ||
"description": "An array of resource objects, an array of resource identifier objects, or an empty array ([]), for requests that target resource collections.", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/resource" | ||
}, | ||
"uniqueItems": true | ||
} | ||
] | ||
}, | ||
"resource": { | ||
"allOf": [ | ||
{ | ||
"$ref": "http://jsonapi.org/schemas/create.json#/definitions/resource" | ||
}, | ||
{ | ||
"required": [ | ||
"id" | ||
] | ||
} | ||
] | ||
}, | ||
"links": { | ||
"description": "A resource object **MAY** contain references to other resource objects (\"relationships\"). Relationships may be to-one or to-many. Relationships can be specified by including a member in a resource's links object.", | ||
"type": "object", | ||
"properties": { | ||
"self": { | ||
"description": "A `self` member, whose value is a URL for the relationship itself (a \"relationship URL\"). This URL allows the client to directly manipulate the relationship. For example, it would allow a client to remove an `author` from an `article` without deleting the people resource itself.", | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"related": { | ||
"$ref": "#/definitions/link" | ||
} | ||
}, | ||
"additionalProperties": true | ||
}, | ||
"link": { | ||
"description": "A link **MUST** be represented as either: a string containing the link's URL or a link object.", | ||
"oneOf": [ | ||
{ | ||
"description": "A string containing the link's URL.", | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"href" | ||
], | ||
"properties": { | ||
"href": { | ||
"description": "A string containing the link's URL.", | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"meta": { | ||
"$ref": "http://jsonapi.org/schemas/response.json#/definitions/meta" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
|
||
"attributes": { | ||
"description": "Members of the attributes object (\"attributes\") represent information about the resource object in which it's defined.", | ||
"type": "object", | ||
"patternProperties": { | ||
"^(?!relationships$|links$)\\w[-\\w_]*$": { | ||
"description": "Attributes may contain any valid JSON value." | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
|
||
"relationships": { | ||
"description": "Members of the relationships object (\"relationships\") represent references from the resource object in which it's defined to other resource objects.", | ||
"type": "object", | ||
"patternProperties": { | ||
"^\\w[-\\w_]*$": { | ||
"properties": { | ||
"links": { | ||
"$ref": "#/definitions/links" | ||
}, | ||
"data": { | ||
"description": "Member, whose value represents \"resource linkage\".", | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/relationshipToOne" | ||
}, | ||
{ | ||
"$ref": "#/definitions/relationshipToMany" | ||
} | ||
] | ||
}, | ||
"meta": { | ||
"$ref": "http://jsonapi.org/schemas/response.json#/definitions/meta" | ||
} | ||
}, | ||
"additionalProperties": true | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"relationshipToOne": { | ||
"description": "References to other resource objects in a to-one (\"relationship\"). Relationships can be specified by including a member in a resource's links object.", | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/empty" | ||
}, | ||
{ | ||
"$ref": "#/definitions/linkage" | ||
} | ||
] | ||
}, | ||
"relationshipToMany": { | ||
"description": "An array of objects each containing \"type\" and \"id\" members for to-many relationships.", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/linkage" | ||
}, | ||
"uniqueItems": true | ||
}, | ||
"empty": { | ||
"description": "Describes an empty to-one relationship.", | ||
"type": "null" | ||
}, | ||
"linkage": { | ||
"description": "The \"type\" and \"id\" to non-empty members.", | ||
"type": "object", | ||
"required": [ | ||
"type", | ||
"id" | ||
], | ||
"properties": { | ||
"type": { | ||
"type": "string" | ||
}, | ||
"id": { | ||
"type": "string" | ||
}, | ||
"meta": { | ||
"$ref": "http://jsonapi.org/schemas/response.json#/definitions/meta" | ||
} | ||
}, | ||
"additionalProperties": true | ||
} | ||
} | ||
} |
The ID should be "http://jsonapi.org/schemas/1_1/create.json". That would need to be changed in each of the schemas.