{"components":{"schemas":{"AllusionDetail":{"additionalProperties":false,"properties":{"allusion_id":{"pattern":"^ar_[1-9][0-9]*$","type":"string"},"canonical_name":{"type":"string"},"corpus_citations":{"items":{"$ref":"#/components/schemas/CorpusCitation"},"type":"array"},"data_source":{"type":"string"},"data_source_ref":{"type":["string","null"]},"focused_sense_id":{"type":["string","null"]},"license":{"type":"string"},"marked_spans":{"items":{"$ref":"#/components/schemas/MarkedSpan"},"type":"array"},"senses":{"items":{"$ref":"#/components/schemas/SenseDetail"},"type":"array"},"snapshot_id":{"type":"string"},"source_text":{"type":["string","null"]},"source_work":{"type":["string","null"]},"source_works":{"items":{"type":"string"},"type":"array"},"system":{"type":"string"},"uri":{"type":"string"}},"required":["system","license","snapshot_id","allusion_id","focused_sense_id","canonical_name","data_source","data_source_ref","source_work","source_works","source_text","marked_spans","senses","corpus_citations","uri"],"type":"object"},"BatchResponse":{"additionalProperties":false,"properties":{"items":{"items":{"$ref":"#/components/schemas/AllusionDetail"},"type":"array"},"license":{"type":"string"},"not_found":{"items":{"type":"string"},"type":"array"},"snapshot_id":{"type":"string"},"system":{"type":"string"}},"required":["system","license","snapshot_id","items","not_found"],"type":"object"},"CorpusCitation":{"additionalProperties":false,"properties":{"citation_id":{"type":"string"},"matched_form":{"type":"string"},"sentence":{"type":"string"},"span":{"items":{"minimum":0,"type":"integer"},"maxItems":2,"minItems":2,"type":"array"},"work":{"type":["string","null"]}},"required":["citation_id","matched_form","sentence","work","span"],"type":"object"},"DataSourceFacet":{"additionalProperties":false,"properties":{"count":{"minimum":0,"type":"integer"},"key":{"type":"string"}},"required":["key","count"],"type":"object"},"FacetsResponse":{"additionalProperties":false,"properties":{"data_sources":{"items":{"$ref":"#/components/schemas/DataSourceFacet"},"type":"array"},"license":{"type":"string"},"snapshot_id":{"type":"string"},"system":{"type":"string"},"top_source_works":{"items":{"$ref":"#/components/schemas/SourceWorkFacet"},"type":"array"}},"required":["system","license","snapshot_id","data_sources","top_source_works"],"type":"object"},"MarkedSpan":{"additionalProperties":false,"properties":{"end":{"minimum":0,"type":"integer"},"start":{"minimum":0,"type":"integer"},"text":{"type":"string"}},"required":["start","end","text"],"type":"object"},"MatchedSense":{"additionalProperties":false,"properties":{"explanation":{"type":"string"},"headword":{"type":"string"},"raw_headword":{"type":"string"},"sense_id":{"pattern":"^as_[1-9][0-9]*$","type":"string"}},"required":["sense_id","headword","raw_headword","explanation"],"type":"object"},"MetaResponse":{"additionalProperties":false,"properties":{"built_at_utc":{"type":"string"},"citation_rows":{"minimum":0,"type":"integer"},"code_version":{"type":"string"},"form_index_rows":{"minimum":0,"type":"integer"},"license":{"type":"string"},"license_url":{"type":"string"},"root_rows":{"minimum":0,"type":"integer"},"schema_version":{"type":"string"},"sense_rows":{"minimum":0,"type":"integer"},"service_version":{"type":"string"},"snapshot_id":{"type":"string"},"system":{"type":"string"},"variant_rows":{"minimum":0,"type":"integer"}},"required":["system","license","license_url","snapshot_id","root_rows","sense_rows","variant_rows","form_index_rows","citation_rows","schema_version","code_version","service_version","built_at_utc"],"type":"object"},"Problem":{"additionalProperties":false,"properties":{"detail":{"type":"string"},"status":{"type":"integer"},"title":{"type":"string"},"type":{"type":"string"}},"required":["type","title","status","detail"],"type":"object"},"SearchItem":{"additionalProperties":false,"properties":{"allusion_id":{"pattern":"^ar_[1-9][0-9]*$","type":"string"},"canonical_name":{"type":"string"},"data_source":{"type":"string"},"form_count":{"minimum":0,"type":"integer"},"match_tier":{"enum":["exact_form","prefix_form","folded_form","text_contains","browse"],"type":"string"},"matched_forms":{"items":{"type":"string"},"type":"array"},"matched_senses":{"items":{"$ref":"#/components/schemas/MatchedSense"},"type":"array"},"sense_count":{"minimum":0,"type":"integer"},"source_excerpt":{"type":["string","null"]},"source_work":{"type":["string","null"]}},"required":["allusion_id","canonical_name","data_source","source_work","source_excerpt","sense_count","form_count","matched_forms","matched_senses","match_tier"],"type":"object"},"SearchPage":{"additionalProperties":false,"properties":{"has_more":{"type":"boolean"},"items":{"items":{"$ref":"#/components/schemas/SearchItem"},"type":"array"},"license":{"type":"string"},"next_page_token":{"type":["string","null"]},"notice":{"type":"string"},"page_size":{"minimum":1,"type":"integer"},"snapshot_id":{"type":"string"},"system":{"type":"string"},"total":{"minimum":0,"type":"integer"}},"required":["system","license","snapshot_id","items","page_size","has_more","next_page_token","notice"],"type":"object"},"SenseDetail":{"additionalProperties":false,"properties":{"explanation":{"type":"string"},"headword":{"type":"string"},"raw_headword":{"type":"string"},"sense_id":{"pattern":"^as_[1-9][0-9]*$","type":"string"},"variants":{"items":{"$ref":"#/components/schemas/SenseVariant"},"type":"array"}},"required":["sense_id","headword","raw_headword","explanation","variants"],"type":"object"},"SenseVariant":{"additionalProperties":false,"properties":{"example_text":{"type":["string","null"]},"example_work":{"type":["string","null"]},"form":{"type":"string"},"origin":{"type":["string","null"]}},"required":["form","example_text","example_work","origin"],"type":"object"},"SourceWorkFacet":{"additionalProperties":false,"properties":{"count":{"minimum":0,"type":"integer"},"work":{"type":"string"}},"required":["work","count"],"type":"object"}}},"info":{"description":"基于 MIT 开源许可《古汉语典故资源库》（ACARD，莫凯洁等，中文信息学报 2024）构建的公开只读接口。面向研究者与外部脚本，按 IP 限流。","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"title":"古汉语典故检索公开接口 /open/v1","version":"0.1.4"},"openapi":"3.1.0","paths":{"/healthz":{"get":{"operationId":"healthz","responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"status":{"type":"string"},"version":{"type":"string"}},"required":["status","version"],"type":"object"}}},"description":"服务库就绪。"},"503":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"服务库不可用。"}},"summary":"健康检查"}},"/open/v1/allusions":{"get":{"operationId":"searchAllusions","parameters":[{"description":"可选查询词（词形或关键词，支持简繁）；省略时进入全库浏览模式。","in":"query","name":"q","schema":{"type":"string"}},{"description":"匹配模式；默认 form。","in":"query","name":"match","schema":{"default":"form","enum":["form","exact","contains"],"type":"string"}},{"description":"可选数据源精确筛选，例如 acard。","in":"query","name":"source","schema":{"type":"string"}},{"description":"可选典源出处书名筛选（匹配 source_work 或 source_works）。","in":"query","name":"work","schema":{"type":"string"}},{"description":"每页条数；默认 20，最大不超过平面上限。","in":"query","name":"page_size","schema":{"default":20,"maximum":50,"minimum":1,"type":"integer"}},{"description":"上一页返回的 next_page_token 游标；绑定 snapshot_id 与筛选参数。","in":"query","name":"page_token","schema":{"type":"string"}},{"description":"为 true/1 时返回匹配总数 total。","in":"query","name":"include_total","schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchPage"}}},"description":"分页典故摘要列表。"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"查询参数非法、page_size 超限或 page_token 与当前筛选条件不匹配。"},"410":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"page_token 所属的数据快照已更新。"},"503":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"服务库暂不可用。"}},"summary":"检索或浏览古汉语典故"}},"/open/v1/allusions/batch":{"post":{"operationId":"batchGetAllusions","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"ids":{"items":{"pattern":"^a[rs]_[1-9][0-9]*$","type":"string"},"maxItems":50,"type":"array"}},"required":["ids"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResponse"}}},"description":"按请求顺序批量返回的典源详情与未命中编号。"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"请求体格式非法、ids 超出上限或包含非法编号。"},"413":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"批量请求体超过 1 MiB 上限。"},"503":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"服务库暂不可用。"}},"summary":"批量读取典源详情"}},"/open/v1/allusions/facets":{"get":{"operationId":"getAllusionFacets","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FacetsResponse"}}},"description":"数据源与主要典源出处书名分面统计。"},"503":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"服务库暂不可用。"}},"summary":"读取数据源与出处书名分面"}},"/open/v1/allusions/{id}":{"get":{"operationId":"getAllusion","parameters":[{"description":"典源编号（ar_<正整数>）或衍生义项编号（as_<正整数>）。","in":"path","name":"id","required":true,"schema":{"pattern":"^a[rs]_[1-9][0-9]*$","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllusionDetail"}}},"description":"典源完整三层谱系与古籍书证。"},"400":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"id 格式非法。"},"404":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"找不到对应典源或义项。"},"503":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"服务库暂不可用。"}},"summary":"读取单条典源完整三层谱系"}},"/open/v1/meta":{"get":{"operationId":"getMeta","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetaResponse"}}},"description":"服务库快照元信息与统计行数。"},"503":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}},"description":"服务库暂不可用。"}},"summary":"读取服务库快照元信息"}}},"servers":[{"url":"/"}]}
