{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://offeringprotocol.org/schemas/service-document.schema.json",
  "title": "ODP Service Document",
  "type": "object",
  "required": [
    "odp_version",
    "name",
    "description",
    "language",
    "localizations",
    "operations",
    "http"
  ],
  "properties": {
    "odp_version": {
      "const": "1.0"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024
    },
    "language": {
      "type": "string",
      "minLength": 2,
      "maxLength": 35
    },
    "localizations": {
      "type": "array",
      "minItems": 1,
      "maxItems": 16,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 2,
        "maxLength": 35
      }
    },
    "keywords": {
      "type": "array",
      "maxItems": 32,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64,
        "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
      }
    },
    "operations": {
      "type": "object",
      "required": [
        "supported"
      ],
      "properties": {
        "supported": {
          "type": "array",
          "minItems": 1,
          "maxItems": 32,
          "uniqueItems": true,
          "allOf": [
            {
              "contains": {
                "const": "list-offerings"
              }
            },
            {
              "contains": {
                "const": "get-offering"
              }
            }
          ],
          "items": {
            "enum": [
              "list-collections",
              "search-collections",
              "get-collection",
              "list-collection-offerings",
              "list-offerings",
              "search-offerings",
              "get-offering"
            ]
          }
        }
      }
    },
    "http": {
      "type": "object",
      "required": [
        "endpoint_base"
      ],
      "properties": {
        "endpoint_base": {
          "type": "string",
          "maxLength": 2048,
          "pattern": "^/(?!/)[A-Za-z0-9._~!$&'()*+,;=:@%/-]*$"
        }
      }
    },
    "protocols": {
      "$ref": "service-protocols.schema.json"
    },
    "search_capabilities": {
      "$ref": "search-capabilities.schema.json"
    }
  }
}
