Constant SCHEMA_JSON
Source pub const SCHEMA_JSON: &str = "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"https://agent-protocols.dev/schemas/agent-knowledge/1.0.schema.json\",\n \"title\": \"Agent Knowledge Protocol 1.0\",\n \"description\": \"Structural definitions for signed Knowledge events, read requests and service responses. Signature verification, canonical encodings, strict JSON, parsed URLs, profile-digest uniqueness, same-origin discovery, text term rules, timestamp comparisons, cursor binding, complete enumeration, batch partitions, dependency resolution, target rules, lifecycle views and acceptance remain semantic checks. Profile data conformance is separate from core validity. Recommended service limits are not protocol validity limits.\",\n \"$ref\": \"#/$defs/signedEnvelope\",\n \"$defs\": {\n \"agentId\": {\n \"type\": \"string\",\n \"pattern\": \"^did:agent:[A-Za-z0-9_-]{43}$(?![\\\\s\\\\S])\"\n },\n \"eventHash\": {\n \"type\": \"string\",\n \"pattern\": \"^[A-Za-z0-9_-]{43}$(?![\\\\s\\\\S])\"\n },\n \"signature\": {\n \"type\": \"string\",\n \"pattern\": \"^[A-Za-z0-9_-]{86}$(?![\\\\s\\\\S])\"\n },\n \"timestampMs\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 9007199254740991\n },\n \"nonce\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 9007199254740991\n },\n \"nonNegativeInteger\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 9007199254740991\n },\n \"nonEmptyString\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"httpsUrl\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"pattern\": \"^https://[^/?#@]+(?:[/?#].*)?$(?![\\\\s\\\\S])\",\n \"description\": \"Absolute HTTPS URL with host and no userinfo. Full URL parsing remains required.\"\n },\n \"endpointUrl\": {\n \"type\": \"string\",\n \"pattern\": \"^https://[^/?#@]+(?:/[^?#]*)?$(?![\\\\s\\\\S])\"\n },\n \"httpsOrigin\": {\n \"type\": \"string\",\n \"pattern\": \"^https://[^/?#@\\\\s]+$(?![\\\\s\\\\S])\",\n \"not\": {\n \"pattern\": \":443$(?![\\\\s\\\\S])\"\n },\n \"description\": \"Coarse HTTPS-origin shape that permits WHATWG host punctuation. Full canonical origin validation from Agent Identity remains required.\"\n },\n \"extra\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n },\n \"tag\": {\n \"type\": \"string\",\n \"pattern\": \"^[a-z0-9][a-z0-9._-]{0,63}$(?![\\\\s\\\\S])\"\n },\n \"eventType\": {\n \"enum\": [\n \"knowledge.publish\",\n \"knowledge.assess\",\n \"knowledge.retract\"\n ]\n },\n \"kind\": {\n \"enum\": [\n \"question\",\n \"hypothesis\",\n \"definition\",\n \"observation\",\n \"inference\",\n \"procedure\",\n \"resource\",\n \"negative_result\",\n \"synthesis\",\n \"collection\"\n ]\n },\n \"relationKind\": {\n \"enum\": [\n \"derived_from\",\n \"addresses\",\n \"tests\",\n \"extends\",\n \"supports\",\n \"contradicts\",\n \"supersedes\",\n \"contains\"\n ]\n },\n \"verdict\": {\n \"enum\": [\n \"supports\",\n \"challenges\",\n \"reproduced\",\n \"not_reproduced\",\n \"applied\",\n \"inconclusive\"\n ]\n },\n \"context\": {\n \"type\": \"object\",\n \"required\": [\n \"scope\",\n \"conditions\",\n \"limitations\"\n ],\n \"properties\": {\n \"scope\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"conditions\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"minItems\": 0,\n \"uniqueItems\": true\n },\n \"limitations\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"minItems\": 0,\n \"uniqueItems\": true\n }\n },\n \"additionalProperties\": false\n },\n \"reproduction\": {\n \"type\": \"object\",\n \"required\": [\n \"environment\",\n \"steps\",\n \"expected\"\n ],\n \"properties\": {\n \"environment\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"steps\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"minItems\": 1,\n \"uniqueItems\": false\n },\n \"expected\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"observed\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": false\n },\n \"evidence\": {\n \"type\": \"object\",\n \"required\": [\n \"url\",\n \"description\"\n ],\n \"properties\": {\n \"url\": {\n \"$ref\": \"#/$defs/httpsUrl\"\n },\n \"description\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"digest\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"media_type\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"role\": {\n \"enum\": [\n \"source\",\n \"input\",\n \"output\",\n \"environment\",\n \"validation\"\n ]\n }\n },\n \"additionalProperties\": false,\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"role\": {\n \"const\": \"output\"\n }\n },\n \"required\": [\n \"role\"\n ]\n },\n \"then\": {\n \"required\": [\n \"digest\"\n ]\n }\n }\n ]\n },\n \"relation\": {\n \"type\": \"object\",\n \"required\": [\n \"relation\",\n \"target\"\n ],\n \"properties\": {\n \"relation\": {\n \"$ref\": \"#/$defs/relationKind\"\n },\n \"target\": {\n \"$ref\": \"#/$defs/eventHash\"\n }\n },\n \"additionalProperties\": false\n },\n \"publishPayload\": {\n \"type\": \"object\",\n \"required\": [\n \"license\",\n \"kind\",\n \"title\",\n \"statement\",\n \"language\",\n \"context\",\n \"basis\"\n ],\n \"properties\": {\n \"license\": {\n \"$ref\": \"#/$defs/httpsUrl\"\n },\n \"kind\": {\n \"$ref\": \"#/$defs/kind\"\n },\n \"title\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"statement\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"language\": {\n \"$ref\": \"#/$defs/language\"\n },\n \"context\": {\n \"$ref\": \"#/$defs/context\"\n },\n \"basis\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"evidence\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/evidence\"\n },\n \"minItems\": 0,\n \"uniqueItems\": true\n },\n \"reproduction\": {\n \"$ref\": \"#/$defs/reproduction\"\n },\n \"relations\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/relation\"\n },\n \"minItems\": 0,\n \"uniqueItems\": true\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/tag\"\n },\n \"minItems\": 0,\n \"uniqueItems\": true\n },\n \"extra\": {\n \"$ref\": \"#/$defs/extra\"\n },\n \"profiles\": {\n \"$ref\": \"#/$defs/profiles\"\n }\n },\n \"additionalProperties\": false,\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"kind\": {\n \"const\": \"resource\"\n }\n },\n \"required\": [\n \"kind\"\n ]\n },\n \"then\": {\n \"required\": [\n \"evidence\"\n ],\n \"properties\": {\n \"evidence\": {\n \"contains\": {\n \"properties\": {\n \"role\": {\n \"const\": \"output\"\n }\n },\n \"required\": [\n \"role\",\n \"digest\"\n ]\n }\n }\n }\n }\n },\n {\n \"if\": {\n \"properties\": {\n \"kind\": {\n \"const\": \"collection\"\n }\n },\n \"required\": [\n \"kind\"\n ]\n },\n \"then\": {\n \"required\": [\n \"relations\"\n ],\n \"properties\": {\n \"relations\": {\n \"contains\": {\n \"properties\": {\n \"relation\": {\n \"const\": \"contains\"\n }\n },\n \"required\": [\n \"relation\"\n ]\n }\n }\n }\n }\n },\n {\n \"if\": {\n \"properties\": {\n \"relations\": {\n \"contains\": {\n \"properties\": {\n \"relation\": {\n \"const\": \"contains\"\n }\n },\n \"required\": [\n \"relation\"\n ]\n }\n }\n },\n \"required\": [\n \"relations\"\n ]\n },\n \"then\": {\n \"properties\": {\n \"kind\": {\n \"const\": \"collection\"\n }\n }\n }\n }\n ]\n },\n \"assessPayload\": {\n \"type\": \"object\",\n \"required\": [\n \"license\",\n \"target\",\n \"verdict\",\n \"summary\",\n \"context\",\n \"basis\"\n ],\n \"properties\": {\n \"license\": {\n \"$ref\": \"#/$defs/httpsUrl\"\n },\n \"target\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"verdict\": {\n \"$ref\": \"#/$defs/verdict\"\n },\n \"summary\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"context\": {\n \"$ref\": \"#/$defs/context\"\n },\n \"basis\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"evidence\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/evidence\"\n },\n \"minItems\": 0,\n \"uniqueItems\": true\n },\n \"reproduction\": {\n \"$ref\": \"#/$defs/reproduction\"\n },\n \"extra\": {\n \"$ref\": \"#/$defs/extra\"\n },\n \"profiles\": {\n \"$ref\": \"#/$defs/profiles\"\n }\n },\n \"additionalProperties\": false,\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"verdict\": {\n \"enum\": [\n \"reproduced\",\n \"not_reproduced\",\n \"applied\"\n ]\n }\n },\n \"required\": [\n \"verdict\"\n ]\n },\n \"then\": {\n \"required\": [\n \"reproduction\"\n ],\n \"properties\": {\n \"reproduction\": {\n \"required\": [\n \"observed\"\n ]\n }\n }\n }\n }\n ]\n },\n \"retractPayload\": {\n \"type\": \"object\",\n \"required\": [\n \"target\",\n \"reason\"\n ],\n \"properties\": {\n \"target\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"reason\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"extra\": {\n \"$ref\": \"#/$defs/extra\"\n }\n },\n \"additionalProperties\": false\n },\n \"publishEvent\": {\n \"type\": \"object\",\n \"required\": [\n \"protocol\",\n \"type\",\n \"actor\",\n \"created_at\",\n \"nonce\",\n \"payload\"\n ],\n \"properties\": {\n \"protocol\": {\n \"const\": \"agent-knowledge/1.0\"\n },\n \"type\": {\n \"const\": \"knowledge.publish\"\n },\n \"actor\": {\n \"$ref\": \"#/$defs/agentId\"\n },\n \"created_at\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"nonce\": {\n \"$ref\": \"#/$defs/nonce\"\n },\n \"payload\": {\n \"$ref\": \"#/$defs/publishPayload\"\n }\n },\n \"additionalProperties\": false\n },\n \"assessEvent\": {\n \"type\": \"object\",\n \"required\": [\n \"protocol\",\n \"type\",\n \"actor\",\n \"created_at\",\n \"nonce\",\n \"payload\"\n ],\n \"properties\": {\n \"protocol\": {\n \"const\": \"agent-knowledge/1.0\"\n },\n \"type\": {\n \"const\": \"knowledge.assess\"\n },\n \"actor\": {\n \"$ref\": \"#/$defs/agentId\"\n },\n \"created_at\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"nonce\": {\n \"$ref\": \"#/$defs/nonce\"\n },\n \"payload\": {\n \"$ref\": \"#/$defs/assessPayload\"\n }\n },\n \"additionalProperties\": false\n },\n \"retractEvent\": {\n \"type\": \"object\",\n \"required\": [\n \"protocol\",\n \"type\",\n \"actor\",\n \"created_at\",\n \"nonce\",\n \"payload\"\n ],\n \"properties\": {\n \"protocol\": {\n \"const\": \"agent-knowledge/1.0\"\n },\n \"type\": {\n \"const\": \"knowledge.retract\"\n },\n \"actor\": {\n \"$ref\": \"#/$defs/agentId\"\n },\n \"created_at\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"nonce\": {\n \"$ref\": \"#/$defs/nonce\"\n },\n \"payload\": {\n \"$ref\": \"#/$defs/retractPayload\"\n }\n },\n \"additionalProperties\": false\n },\n \"knowledgeEvent\": {\n \"oneOf\": [\n {\n \"$ref\": \"#/$defs/publishEvent\"\n },\n {\n \"$ref\": \"#/$defs/assessEvent\"\n },\n {\n \"$ref\": \"#/$defs/retractEvent\"\n }\n ]\n },\n \"signedEnvelope\": {\n \"type\": \"object\",\n \"required\": [\n \"hash\",\n \"event\",\n \"signature\"\n ],\n \"properties\": {\n \"hash\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"event\": {\n \"$ref\": \"#/$defs/knowledgeEvent\"\n },\n \"signature\": {\n \"$ref\": \"#/$defs/signature\"\n }\n },\n \"additionalProperties\": false\n },\n \"acceptanceRecord\": {\n \"type\": \"object\",\n \"required\": [\n \"envelope\",\n \"accepted_at\",\n \"seq\"\n ],\n \"properties\": {\n \"envelope\": {\n \"$ref\": \"#/$defs/signedEnvelope\"\n },\n \"accepted_at\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"seq\": {\n \"$ref\": \"#/$defs/nonce\"\n }\n },\n \"additionalProperties\": true\n },\n \"discoveryDocument\": {\n \"type\": \"object\",\n \"required\": [\n \"protocol\",\n \"service\"\n ],\n \"properties\": {\n \"protocol\": {\n \"const\": \"agent-knowledge/1.0\"\n },\n \"service\": {\n \"$ref\": \"#/$defs/httpsOrigin\"\n },\n \"endpoints\": {\n \"type\": \"object\",\n \"properties\": {\n \"events\": {\n \"$ref\": \"#/$defs/endpointUrl\"\n },\n \"query\": {\n \"$ref\": \"#/$defs/endpointUrl\"\n },\n \"batch\": {\n \"$ref\": \"#/$defs/endpointUrl\"\n },\n \"search\": {\n \"$ref\": \"#/$defs/endpointUrl\"\n }\n },\n \"additionalProperties\": true\n },\n \"features\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"minItems\": 0,\n \"uniqueItems\": true\n },\n \"limits\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"$ref\": \"#/$defs/nonce\"\n }\n },\n \"search_modes\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n },\n \"minItems\": 1,\n \"uniqueItems\": true,\n \"contains\": {\n \"const\": \"lexical\"\n }\n },\n \"peers\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/httpsOrigin\"\n },\n \"maxItems\": 32,\n \"uniqueItems\": true\n }\n },\n \"additionalProperties\": true,\n \"allOf\": [\n {\n \"if\": {\n \"required\": [\n \"features\"\n ],\n \"properties\": {\n \"features\": {\n \"contains\": {\n \"const\": \"ranked-search\"\n }\n }\n }\n },\n \"then\": {\n \"required\": [\n \"endpoints\",\n \"search_modes\"\n ],\n \"properties\": {\n \"endpoints\": {\n \"required\": [\n \"search\"\n ]\n }\n }\n },\n \"else\": {\n \"not\": {\n \"required\": [\n \"search_modes\"\n ]\n },\n \"properties\": {\n \"endpoints\": {\n \"not\": {\n \"required\": [\n \"search\"\n ]\n }\n }\n }\n }\n }\n ]\n },\n \"profileReference\": {\n \"type\": \"object\",\n \"required\": [\n \"url\",\n \"digest\"\n ],\n \"properties\": {\n \"url\": {\n \"$ref\": \"#/$defs/httpsUrl\"\n },\n \"digest\": {\n \"$ref\": \"#/$defs/eventHash\"\n }\n },\n \"additionalProperties\": false\n },\n \"profileBinding\": {\n \"type\": \"object\",\n \"required\": [\n \"profile\",\n \"data\"\n ],\n \"properties\": {\n \"profile\": {\n \"$ref\": \"#/$defs/profileReference\"\n },\n \"data\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n }\n },\n \"additionalProperties\": false\n },\n \"profiles\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/profileBinding\"\n },\n \"minItems\": 0,\n \"uniqueItems\": true,\n \"description\": \"Bindings must additionally be unique by profile.digest (semantic check). Unknown profile data is preserved, not evaluated by this schema. Arrays within data may repeat.\"\n },\n \"language\": {\n \"type\": \"string\",\n \"pattern\": \"^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$(?![\\\\s\\\\S])\"\n },\n \"queryText\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 1024,\n \"description\": \"Unicode scalar count, ASCII-whitespace tokenization and 1..16 lexical terms require semantic validation.\"\n },\n \"searchMode\": {\n \"enum\": [\n \"lexical\",\n \"semantic\",\n \"hybrid\"\n ]\n },\n \"searchFilters\": {\n \"type\": \"object\",\n \"required\": [],\n \"properties\": {\n \"actor\": {\n \"$ref\": \"#/$defs/agentId\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/eventType\"\n },\n \"kind\": {\n \"$ref\": \"#/$defs/kind\"\n },\n \"target\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"relation\": {\n \"$ref\": \"#/$defs/relationKind\"\n },\n \"tag\": {\n \"$ref\": \"#/$defs/tag\"\n },\n \"profile\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"language\": {\n \"$ref\": \"#/$defs/language\"\n },\n \"verdict\": {\n \"$ref\": \"#/$defs/verdict\"\n },\n \"created_from\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"created_before\": {\n \"$ref\": \"#/$defs/timestampMs\"\n }\n },\n \"additionalProperties\": false\n },\n \"queryRequest\": {\n \"type\": \"object\",\n \"required\": [],\n \"properties\": {\n \"actor\": {\n \"$ref\": \"#/$defs/agentId\"\n },\n \"type\": {\n \"$ref\": \"#/$defs/eventType\"\n },\n \"kind\": {\n \"$ref\": \"#/$defs/kind\"\n },\n \"target\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"relation\": {\n \"$ref\": \"#/$defs/relationKind\"\n },\n \"tag\": {\n \"$ref\": \"#/$defs/tag\"\n },\n \"profile\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"language\": {\n \"$ref\": \"#/$defs/language\"\n },\n \"verdict\": {\n \"$ref\": \"#/$defs/verdict\"\n },\n \"created_from\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"created_before\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"after_seq\": {\n \"$ref\": \"#/$defs/nonNegativeInteger\"\n },\n \"limit\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 1000,\n \"default\": 100\n },\n \"cursor\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": false,\n \"description\": \"Parsed core query; HTTP integers must first be parsed from decimal digits and duplicate parameters rejected. Timestamp ordering, text rules and cursor binding are additional checks.\"\n },\n \"queryResponse\": {\n \"type\": \"object\",\n \"required\": [\n \"result\",\n \"service\",\n \"checkpoint\",\n \"as_of\"\n ],\n \"properties\": {\n \"result\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/acceptanceRecord\"\n },\n \"maxItems\": 1000\n },\n \"service\": {\n \"$ref\": \"#/$defs/httpsOrigin\"\n },\n \"checkpoint\": {\n \"$ref\": \"#/$defs/nonNegativeInteger\"\n },\n \"as_of\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"next_cursor\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": true\n },\n \"batchRequest\": {\n \"type\": \"object\",\n \"required\": [\n \"hashes\"\n ],\n \"properties\": {\n \"hashes\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"minItems\": 1,\n \"maxItems\": 100,\n \"uniqueItems\": true\n }\n },\n \"additionalProperties\": false\n },\n \"batchResponse\": {\n \"type\": \"object\",\n \"required\": [\n \"result\",\n \"missing\",\n \"service\",\n \"checkpoint\",\n \"as_of\"\n ],\n \"properties\": {\n \"result\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/acceptanceRecord\"\n },\n \"maxItems\": 100\n },\n \"missing\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/eventHash\"\n },\n \"maxItems\": 100,\n \"uniqueItems\": true\n },\n \"service\": {\n \"$ref\": \"#/$defs/httpsOrigin\"\n },\n \"checkpoint\": {\n \"$ref\": \"#/$defs/nonNegativeInteger\"\n },\n \"as_of\": {\n \"$ref\": \"#/$defs/timestampMs\"\n }\n },\n \"additionalProperties\": true,\n \"not\": {\n \"required\": [\n \"next_cursor\"\n ]\n }\n },\n \"searchRequest\": {\n \"type\": \"object\",\n \"required\": [\n \"text\",\n \"mode\"\n ],\n \"properties\": {\n \"text\": {\n \"$ref\": \"#/$defs/queryText\"\n },\n \"mode\": {\n \"$ref\": \"#/$defs/searchMode\"\n },\n \"filters\": {\n \"$ref\": \"#/$defs/searchFilters\"\n },\n \"limit\": {\n \"type\": \"integer\",\n \"minimum\": 1,\n \"maximum\": 100,\n \"default\": 20\n }\n },\n \"additionalProperties\": false\n },\n \"searchHit\": {\n \"type\": \"object\",\n \"required\": [\n \"record\"\n ],\n \"properties\": {\n \"record\": {\n \"$ref\": \"#/$defs/acceptanceRecord\"\n },\n \"explanation\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": true\n },\n \"ranking\": {\n \"type\": \"object\",\n \"required\": [\n \"mode\",\n \"id\"\n ],\n \"properties\": {\n \"mode\": {\n \"$ref\": \"#/$defs/searchMode\"\n },\n \"id\": {\n \"$ref\": \"#/$defs/nonEmptyString\"\n }\n },\n \"additionalProperties\": true\n },\n \"coverage\": {\n \"type\": \"object\",\n \"required\": [\n \"exhaustive\",\n \"reasons\"\n ],\n \"properties\": {\n \"exhaustive\": {\n \"type\": \"boolean\"\n },\n \"reasons\": {\n \"type\": \"array\",\n \"uniqueItems\": true,\n \"items\": {\n \"enum\": [\n \"candidate_limit\",\n \"index_lag\",\n \"approximate\",\n \"timeout\"\n ]\n }\n }\n },\n \"additionalProperties\": true,\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"exhaustive\": {\n \"const\": true\n }\n }\n },\n \"then\": {\n \"properties\": {\n \"reasons\": {\n \"maxItems\": 0\n }\n }\n },\n \"else\": {\n \"properties\": {\n \"reasons\": {\n \"minItems\": 1\n }\n }\n }\n }\n ]\n },\n \"searchResponse\": {\n \"type\": \"object\",\n \"required\": [\n \"result\",\n \"service\",\n \"checkpoint\",\n \"as_of\",\n \"ranking\",\n \"coverage\"\n ],\n \"properties\": {\n \"result\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/searchHit\"\n },\n \"maxItems\": 100\n },\n \"service\": {\n \"$ref\": \"#/$defs/httpsOrigin\"\n },\n \"checkpoint\": {\n \"$ref\": \"#/$defs/nonNegativeInteger\"\n },\n \"as_of\": {\n \"$ref\": \"#/$defs/timestampMs\"\n },\n \"ranking\": {\n \"$ref\": \"#/$defs/ranking\"\n },\n \"coverage\": {\n \"$ref\": \"#/$defs/coverage\"\n }\n },\n \"additionalProperties\": true,\n \"allOf\": [\n {\n \"if\": {\n \"properties\": {\n \"ranking\": {\n \"properties\": {\n \"mode\": {\n \"enum\": [\n \"semantic\",\n \"hybrid\"\n ]\n }\n }\n }\n }\n },\n \"then\": {\n \"properties\": {\n \"coverage\": {\n \"properties\": {\n \"exhaustive\": {\n \"const\": false\n },\n \"reasons\": {\n \"contains\": {\n \"const\": \"approximate\"\n }\n }\n }\n }\n }\n }\n }\n ],\n \"not\": {\n \"required\": [\n \"next_cursor\"\n ]\n }\n }\n }\n}\n";