{
  "id": "https://schema.entrecode.de/schema-data/hal",
  "definitions": {
    "baseResource": {
      "type": "object",
      "properties": {
        "_links": {
          "type": "object"
        },
        "_embedded": {
          "type": "object"
        }
      }
    },
    "halResource": {
      "allOf": [
        {
          "$ref": "#/definitions/baseResource"
        },
        {
          "properties": {
            "_links": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/linkOrLinkArray"
              }
            },
            "_embedded": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/definitions/halResourceOrHalResourceArray"
              }
            }
          }
        }
      ]
    },
    "linkOrLinkArray": {
      "oneOf": [
        {
          "$ref": "#/definitions/link"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/definitions/link"
          }
        }
      ]
    },
    "halResourceOrHalResourceArray": {
      "oneOf": [
        {
          "$ref": "#/definitions/halResource"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/definitions/halResource"
          }
        }
      ]
    },
    "link": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "title": "Media type indication of the target resource",
          "pattern": "^(application|audio|example|image|message|model|multipart|text|video)\/[a-zA-Z0-9!#$&.+-^_]{1,127}$",
          "description": "When present, used as a hint to indicate the media type expected when dereferencing the target resource."
        },
        "title": {
          "type": "string",
          "title": "Human-readable identifier",
          "description": "When present, is used to label the destination of a link such that it can be used as a human-readable identifier (e.g. a menu entry) in the language indicated by the Content-Language header (if present)."
        },
        "templated": {
          "type": "boolean",
          "title": "URI Template",
          "description": "Is true when the link object's href property is a URI Template. Defaults to false.",
          "default": false
        },
        "profile": {
          "type": "string",
          "title": "Additional semantics of the target resource",
          "format": "uri",
          "description": "A URI that, when dereferenced, results in a profile to allow clients to learn about additional semantics (constraints, conventions, extensions) that are associated with the target resource representation, in addition to those defined by the HAL media type and relations."
        },
        "name": {
          "type": "string",
          "title": "Secondary key",
          "description": "When present, may be used as a secondary key for selecting link objects that contain the same relation type."
        },
        "hreflang": {
          "type": "string",
          "title": "Language indication of the target resource [RFC5988]",
          "pattern": "^([a-zA-Z]{2,3}(-[a-zA-Z]{3}(-[a-zA-Z]{3}){0,2})?(-[a-zA-Z]{4})?(-([a-zA-Z]{2}|[0-9]{3}))?(-([a-zA-Z0-9]{5,8}|[0-9][a-zA-Z0-9]{3}))*([0-9A-WY-Za-wy-z](-[a-zA-Z0-9]{2,8}){1,})*(x-[a-zA-Z0-9]{2,8})?)|(x-[a-zA-Z0-9]{2,8})|(en-GB-oed)|(i-ami)|(i-bnn)|(i-default)|(i-enochian)|(i-hak)|(i-klingon)|(i-lux)|(i-mingo)|(i-navajo)|(i-pwn)|(i-tao)|(i-tay)|(i-tsu)|(sgn-BE-FR)|(sgn-BE-NL)|(sgn-CH-DE)|(art-lojban)|(cel-gaulish)|(no-bok)|(no-nyn)|(zh-guoyu)|(zh-hakka)|(zh-min)|(zh-min-nan)|(zh-xiang)$",
          "description": "When present, is a hint in RFC5646 format indicating what the language of the result of dereferencing the link should be.  Note that this is only a hint; for example, it does not override the Content-Language header of a HTTP response obtained by actually following the link."
        },
        "href": {
          "type": "string",
          "title": "URI of the target resource",
          "format": "url",
          "description": "Either a URI [RFC3986] or URI Template [RFC6570] of the target resource."
        },
        "deprecation": {
          "type": "string",
          "title": "Indicates that the link is to be deprecated",
          "format": "url",
          "description": "When present, do not use this link anymore. It can be removed in the future. Clients using links marked as deprecated should log a warning."
        }
      },
      "additionalProperties": false,
      "required": [
        "href"
      ]
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
