diff --git a/lib/schema.json b/lib/schema.json index 8d745f1..4a56469 100644 --- a/lib/schema.json +++ b/lib/schema.json @@ -150,15 +150,14 @@ }, "additionalProperties": false }, - - "links": { + + "relationshipLinks": { "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" + "$ref": "#/definitions/link" }, "related": { "$ref": "#/definitions/link" @@ -166,13 +165,19 @@ }, "additionalProperties": true }, + "links": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/link" + } + }, "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" + "format": "uri-reference" }, { "type": "object", @@ -183,7 +188,7 @@ "href": { "description": "A string containing the link's URL.", "type": "string", - "format": "uri" + "format": "uri-reference" }, "meta": { "$ref": "#/definitions/meta" @@ -197,7 +202,7 @@ "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_]*$": { + "^(?!relationships$|links$|id$|type$)\\w[-\\w_]*$": { "description": "Attributes may contain any valid JSON value." } }, @@ -208,10 +213,10 @@ "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_]*$": { + "^(?!id$|type$)\\w[-\\w_]*$": { "properties": { "links": { - "$ref": "#/definitions/links" + "$ref": "#/definitions/relationshipLinks" }, "data": { "description": "Member, whose value represents \"resource linkage\".", @@ -287,28 +292,28 @@ "first": { "description": "The first page of data", "oneOf": [ - { "type": "string", "format": "uri" }, + { "type": "string", "format": "uri-reference" }, { "type": "null" } ] }, "last": { "description": "The last page of data", "oneOf": [ - { "type": "string", "format": "uri" }, + { "type": "string", "format": "uri-reference" }, { "type": "null" } ] }, "prev": { "description": "The previous page of data", "oneOf": [ - { "type": "string", "format": "uri" }, + { "type": "string", "format": "uri-reference" }, { "type": "null" } ] }, "next": { "description": "The next page of data", "oneOf": [ - { "type": "string", "format": "uri" }, + { "type": "string", "format": "uri-reference" }, { "type": "null" } ] }