{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mdprint-app/json-schema/mdprint-app-search-response-schema.json",
  "title": "SearchResponse",
  "x-generated": "2026-11-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mdprint-app-openapi.json#/components/schemas/SearchResponse",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "_meta": {
          "$ref": "#/$defs/SearchMeta"
        },
        "results": {
          "type": "array",
          "maxItems": 5,
          "items": {
            "$ref": "#/$defs/SearchResult"
          }
        }
      },
      "required": [
        "_meta",
        "results"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "_meta": {
          "$ref": "#/$defs/SearchMeta"
        },
        "error": {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "_meta",
        "error"
      ],
      "additionalProperties": false
    }
  ],
  "$defs": {
    "SearchMeta": {
      "type": "object",
      "properties": {
        "response_type": {
          "type": "string",
          "enum": [
            "answer",
            "failure"
          ]
        },
        "response_format": {
          "const": "conversational_search"
        },
        "version": {
          "const": "0.55"
        }
      },
      "required": [
        "response_type",
        "response_format",
        "version"
      ],
      "additionalProperties": false
    },
    "SearchResult": {
      "type": "object",
      "properties": {
        "@context": {
          "const": "https://schema.org"
        },
        "@type": {
          "type": "string",
          "enum": [
            "TechArticle",
            "CreativeWork"
          ]
        },
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "description": {
          "type": "string"
        },
        "grounding": {
          "type": "object",
          "properties": {
            "source_url": {
              "type": "string",
              "format": "uri"
            },
            "retrieval_method": {
              "const": "keyword_match"
            }
          },
          "required": [
            "source_url",
            "retrieval_method"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "@context",
        "@type",
        "name",
        "url",
        "description",
        "grounding"
      ],
      "additionalProperties": false
    }
  }
}