{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openservicedirectory.org/schemas/osd-directories/0.1.0.schema.json",
  "title": "OSD registry directory",
  "description": "Registry operators and their search endpoints. This format version is independent of the OSD search contract version.",
  "$comment": "Clients also check unique registry IDs, unique canonical search endpoints, and identical records for repeated operator IDs.",
  "type": "object",
  "required": [
    "schemaVersion",
    "updatedAt",
    "registries"
  ],
  "properties": {
    "schemaVersion": {
      "const": "0.1.0"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "registries": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/registry"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "id": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{0,63}$"
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "httpsUrl": {
      "type": "string",
      "format": "uri",
      "pattern": "^[Hh][Tt][Tt][Pp][Ss]://(?:[A-Za-z0-9.-]+|\\[[0-9A-Fa-f:.]+\\])(?::[0-9]+)?(?:[/?][^#\\s\\\\\\u0000-\\u001f\\u007f-\\u009f]*)?$"
    },
    "operator": {
      "type": "object",
      "required": [
        "id",
        "name",
        "url"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "url": {
          "$ref": "#/$defs/httpsUrl"
        }
      },
      "additionalProperties": false
    },
    "registry": {
      "type": "object",
      "required": [
        "id",
        "name",
        "operator",
        "searchEndpoint",
        "status"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "operator": {
          "$ref": "#/$defs/operator"
        },
        "searchEndpoint": {
          "$ref": "#/$defs/httpsUrl"
        },
        "status": {
          "enum": [
            "active",
            "suspended"
          ]
        }
      },
      "additionalProperties": false
    }
  }
}
