{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openservicedirectory.org/schemas/registry-search-response/0.3.0.schema.json",
  "$comment": "OSD profile of the ARD v0.91 SearchResponse in spec/schemas/ard.openapi.yaml at commit aa3e598bb7752a9175897823234311216acfa864. OSD search results require complete OSD catalog entries in addition to the ARD score and source fields.",
  "title": "OSD registry search response",
  "type": "object",
  "required": ["results"],
  "properties": {
    "results": { "type": "array", "items": { "$ref": "#/$defs/searchResultItem" } },
    "referrals": {
      "type": "array",
      "description": "Upstream registries recommended to the client in referrals federation mode.",
      "items": { "$ref": "#/$defs/registryReferral" }
    },
    "pageToken": { "type": "string", "description": "Token for paging subsequent results." }
  },
  "additionalProperties": false,
  "$defs": {
    "searchResultItem": {
      "allOf": [
        { "$ref": "https://openservicedirectory.org/schemas/osd-catalog-entry/0.3.0.schema.json" },
        {
          "type": "object",
          "required": ["score", "source"],
          "properties": {
            "score": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100,
              "description": "Semantic relevance rating computed by the registry. This is not a security or trust score."
            },
            "source": {
              "type": "string",
              "format": "uri",
              "description": "URL endpoint of the registry where the entry was indexed."
            }
          }
        }
      ]
    },
    "registryReferral": {
      "type": "object",
      "required": ["identifier", "displayName", "type", "url"],
      "properties": {
        "identifier": { "type": "string", "description": "Logical identifier of the referred registry." },
        "displayName": { "type": "string", "description": "Name of the referred registry." },
        "type": {
          "type": "string",
          "enum": ["application/ai-registry", "application/ai-registry+json"],
          "description": "Registry media type identifier."
        },
        "url": { "type": "string", "format": "uri", "description": "Endpoint URL of the referred registry." }
      }
    }
  }
}
