v3-tipitaka-titles.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-tipitaka-titles.yaml
  2. get:
  3. summary: 找章节
  4. tags:
  5. - tipitaka-titles
  6. operationId: get_api_v3_tipitaka_titles
  7. description: |-
  8. 两种用法,可以叠加:
  9. - **按名字找**(给 `q`):巴利名不分大小写、变音符号可有可无(`mahaparinibbana`),可以只写
  10. 名字的一部分,拼错一两个字母也能找到;也能用公开译本里的章节译名(如「大般涅槃经」)。
  11. 按匹配度排序,带 `score`(相等 1、开头相同 0.95、包含 0.9,拼错的按相似度最高 0.85);同一档里根本典在前,再按与整个标题的接近度、大章在前。
  12. - **列出一本书的标题**(给 `book`,不给 `q`):按经文顺序。再给 `para` 只列那一章下面的;
  13. `max_level` 限制层级深浅。
  14. `layer` 是这本书属于根本典(mula)、义注(atthakatha)、复注(tika)还是其他(anna);
  15. `paragraphs` / `chars` 是这一章的段数与字符数;`parent` / `prev` / `next` 是同一本书里的段号,
  16. 没有为 null;`path` 是从丛书到上一级的路径(不含本章)。
  17. 实现:`V3\TipitakaTitleController@__invoke`
  18. security:
  19. - { }
  20. -
  21. bearerAuth: []
  22. parameters:
  23. -
  24. name: page
  25. in: query
  26. schema:
  27. type: integer
  28. default: 1
  29. description: 页码
  30. -
  31. name: per_page
  32. in: query
  33. schema:
  34. type: integer
  35. default: 50
  36. description: '每页数量,最大 1000'
  37. -
  38. name: q
  39. in: query
  40. schema:
  41. type: string
  42. description: '章节名:巴利名或译名,不给 book 时必填'
  43. example: mahaparinibbana
  44. -
  45. name: book
  46. in: query
  47. schema:
  48. type: integer
  49. description: '书号,不给 q 时必填'
  50. example: 94
  51. -
  52. name: para
  53. in: query
  54. schema:
  55. type: integer
  56. description: '只列 book 里这一章下面的标题(含它自己),要和 book 一起给'
  57. example: 287
  58. -
  59. name: layer
  60. in: query
  61. schema:
  62. type: string
  63. enum:
  64. - mula
  65. - atthakatha
  66. - tika
  67. - anna
  68. description: 只要某几层,逗号分隔
  69. -
  70. name: max_level
  71. in: query
  72. schema:
  73. type: integer
  74. description: '只要层级不深于它的标题(1 是书名)'
  75. example: 3
  76. responses:
  77. 200:
  78. description: 成功
  79. content:
  80. application/json:
  81. schema:
  82. type: object
  83. properties:
  84. data:
  85. type: array
  86. items:
  87. type: object
  88. properties:
  89. book:
  90. type: integer
  91. para:
  92. type: integer
  93. level:
  94. type: integer
  95. title:
  96. type: string
  97. translations:
  98. type: array
  99. items: { type: object, properties: { lang: { type: string }, title: { type: string } } }
  100. layer:
  101. type: string
  102. paragraphs:
  103. type: integer
  104. chars:
  105. type: integer
  106. parent:
  107. type: integer
  108. nullable: true
  109. prev:
  110. type: integer
  111. nullable: true
  112. next:
  113. type: integer
  114. nullable: true
  115. path:
  116. type: array
  117. items: { type: object, properties: { book: { type: integer }, para: { type: integer }, title: { type: string }, level: { type: integer } } }
  118. score:
  119. type: number
  120. description: 仅在部分查询口径下返回。
  121. meta:
  122. $ref: '../../main.yaml#/components/schemas/PaginationMeta'
  123. 422:
  124. $ref: '../../main.yaml#/components/responses/ProblemValidation'