{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://raw.githubusercontent.com/api-evangelist/hypermedia/refs/heads/main/json-schema/hypermedia-hal-resource-schema.json", "title": "HALResource", "description": "A HAL (Hypertext Application Language) resource representation, including embedded link relations and embedded resources as defined by draft-kelly-json-hal.", "type": "object", "properties": { "_links": { "type": "object", "description": "Map of link relation names to HAL Link Objects (or arrays of Link Objects). The 'self' relation is conventionally required for HAL resources.", "additionalProperties": { "oneOf": [ { "$ref": "#/$defs/HALLink" }, { "type": "array", "items": { "$ref": "#/$defs/HALLink" } } ] }, "example": { "self": { "href": "/orders/523" }, "next": { "href": "/orders/524" }, "ea:basket": { "href": "/baskets/97213" } } }, "_embedded": { "type": "object", "description": "Map of link relation names to embedded HAL resources (or arrays of resources) included inline with the parent.", "additionalProperties": { "oneOf": [ { "$ref": "#" }, { "type": "array", "items": { "$ref": "#" } } ] }, "example": { "ea:order": [ { "_links": { "self": { "href": "/orders/523" } }, "total": 30.0, "currency": "USD" } ] } } }, "additionalProperties": true, "$defs": { "HALLink": { "type": "object", "description": "A HAL Link Object describing a hyperlink from the containing resource.", "properties": { "href": { "type": "string", "description": "Either a URI or a URI Template (RFC 6570) when 'templated' is true.", "example": "/orders/523" }, "templated": { "type": "boolean", "description": "Whether the href is a URI Template.", "example": false }, "type": { "type": "string", "description": "Media type expected when dereferencing the target.", "example": "application/hal+json" }, "deprecation": { "type": "string", "format": "uri", "description": "URL pointing to information about deprecation of this link.", "example": "https://example.com/deprecation/orders" }, "name": { "type": "string", "description": "Secondary key used to distinguish between Link Objects sharing the same relation type.", "example": "primary" }, "profile": { "type": "string", "format": "uri", "description": "URI identifying additional semantics of the target resource.", "example": "https://example.com/profiles/order" }, "title": { "type": "string", "description": "Human-readable label for the link, used as a user-facing identifier.", "example": "Next order" }, "hreflang": { "type": "string", "description": "Indicates the language of the target resource.", "example": "en" } }, "required": ["href"] } } }