|
| 1 | +{ |
| 2 | + "$schema": "http://json-schema.org/draft-04/schema#", |
| 3 | + "title": "JSON API Schema", |
| 4 | + "description": "This is a schema for responses in the JSON API format. For more, see http://jsonapi.org", |
| 5 | + "type": "object", |
| 6 | + "required": [ |
| 7 | + "errors" |
| 8 | + ], |
| 9 | + "properties": { |
| 10 | + "errors": { |
| 11 | + "type": "array", |
| 12 | + "items": { |
| 13 | + "$ref": "#/definitions/error" |
| 14 | + }, |
| 15 | + "uniqueItems": true |
| 16 | + }, |
| 17 | + "meta": { |
| 18 | + "$ref": "#/definitions/meta" |
| 19 | + }, |
| 20 | + "links": { |
| 21 | + "$ref": "#/definitions/links" |
| 22 | + } |
| 23 | + }, |
| 24 | + "additionalProperties": false, |
| 25 | + "definitions": { |
| 26 | + "meta": { |
| 27 | + "description": "Non-standard meta-information that can not be represented as an attribute or relationship.", |
| 28 | + "type": "object", |
| 29 | + "additionalProperties": true |
| 30 | + }, |
| 31 | + "links": { |
| 32 | + "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.", |
| 33 | + "type": "object", |
| 34 | + "properties": { |
| 35 | + "self": { |
| 36 | + "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.", |
| 37 | + "type": "string", |
| 38 | + "format": "uri" |
| 39 | + }, |
| 40 | + "related": { |
| 41 | + "$ref": "#/definitions/link" |
| 42 | + } |
| 43 | + }, |
| 44 | + "additionalProperties": true |
| 45 | + }, |
| 46 | + "link": { |
| 47 | + "description": "A link **MUST** be represented as either: a string containing the link's URL or a link object.", |
| 48 | + "oneOf": [ |
| 49 | + { |
| 50 | + "description": "A string containing the link's URL.", |
| 51 | + "type": "string", |
| 52 | + "format": "uri" |
| 53 | + }, |
| 54 | + { |
| 55 | + "type": "object", |
| 56 | + "required": [ |
| 57 | + "href" |
| 58 | + ], |
| 59 | + "properties": { |
| 60 | + "href": { |
| 61 | + "description": "A string containing the link's URL.", |
| 62 | + "type": "string", |
| 63 | + "format": "uri" |
| 64 | + }, |
| 65 | + "meta": { |
| 66 | + "$ref": "#/definitions/meta" |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | + ] |
| 71 | + }, |
| 72 | + "error": { |
| 73 | + "type": "object", |
| 74 | + "properties": { |
| 75 | + "id": { |
| 76 | + "description": "A unique identifier for this particular occurrence of the problem.", |
| 77 | + "type": "string" |
| 78 | + }, |
| 79 | + "links": { |
| 80 | + "$ref": "#/definitions/links" |
| 81 | + }, |
| 82 | + "status": { |
| 83 | + "description": "The HTTP status code applicable to this problem, expressed as a string value.", |
| 84 | + "type": "string" |
| 85 | + }, |
| 86 | + "code": { |
| 87 | + "description": "An application-specific error code, expressed as a string value.", |
| 88 | + "type": "string" |
| 89 | + }, |
| 90 | + "title": { |
| 91 | + "description": "A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization.", |
| 92 | + "type": "string" |
| 93 | + }, |
| 94 | + "detail": { |
| 95 | + "description": "A human-readable explanation specific to this occurrence of the problem.", |
| 96 | + "type": "string" |
| 97 | + }, |
| 98 | + "source": { |
| 99 | + "type": "object", |
| 100 | + "properties": { |
| 101 | + "pointer": { |
| 102 | + "description": "A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute].", |
| 103 | + "type": "string" |
| 104 | + }, |
| 105 | + "parameter": { |
| 106 | + "description": "A string indicating which query parameter caused the error.", |
| 107 | + "type": "string" |
| 108 | + } |
| 109 | + } |
| 110 | + }, |
| 111 | + "meta": { |
| 112 | + "$ref": "#/definitions/meta" |
| 113 | + } |
| 114 | + }, |
| 115 | + "additionalProperties": false |
| 116 | + } |
| 117 | + } |
| 118 | +} |
0 commit comments