Просмотр исходного кода

feat(openapi): 新增 GET /v3/tipitaka-discussions/{channel}(按章 / 段落区间列讨论,带句子坐标)

discussions 的响应多一个可选的 sentence;列表默认类型补上 glossary。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 1 день назад
Родитель
Сommit
c6049fb4f6

+ 2 - 0
openapi/public/assets/protocol/main.yaml

@@ -725,6 +725,8 @@ paths:
     $ref: ./resources/auto/v3-search-search.yaml
   /v3/sessions:
     $ref: ./resources/auto/v3-sessions.yaml
+  '/v3/tipitaka-discussions/{channel}':
+    $ref: ./resources/auto/v3-tipitaka-discussions-channel.yaml
   '/v3/tipitaka-reading/{channel}':
     $ref: ./resources/auto/v3-tipitaka-reading-channel.yaml
   /v3/tipitaka-related-paragraphs:

+ 20 - 0
openapi/public/assets/protocol/resources/auto/v3-discussions-discussion-replies.yaml

@@ -98,6 +98,10 @@ get:
                     reply_count:
                       type: integer
                       description: 仅在部分查询口径下返回。
+                    sentence:
+                      type: object
+                      properties: { book: { type: integer }, paragraph: { type: integer }, word_start: { type: integer }, word_end: { type: integer } }
+                      description: 仅在部分查询口径下返回。
                     editor:
                       type: object
                       properties: { id: { type: string }, nickName: { type: string }, userName: { type: string }, realName: { type: string }, sn: { type: integer }, avatar: { type: string }, roles: { type: array, items: { type: string } } }
@@ -220,6 +224,14 @@ post:
                   reply_count:
                     type: integer
                     description: 仅在部分查询口径下返回。
+                  sentence:
+                    type: object
+                    properties:
+                      book: { type: integer }
+                      paragraph: { type: integer }
+                      word_start: { type: integer }
+                      word_end: { type: integer }
+                    description: 仅在部分查询口径下返回。
                   editor:
                     type: object
                     properties:
@@ -317,6 +329,14 @@ post:
                   reply_count:
                     type: integer
                     description: 仅在部分查询口径下返回。
+                  sentence:
+                    type: object
+                    properties:
+                      book: { type: integer }
+                      paragraph: { type: integer }
+                      word_start: { type: integer }
+                      word_end: { type: integer }
+                    description: 仅在部分查询口径下返回。
                   editor:
                     type: object
                     properties:

+ 24 - 0
openapi/public/assets/protocol/resources/auto/v3-discussions-discussion.yaml

@@ -83,6 +83,14 @@ get:
                   reply_count:
                     type: integer
                     description: 仅在部分查询口径下返回。
+                  sentence:
+                    type: object
+                    properties:
+                      book: { type: integer }
+                      paragraph: { type: integer }
+                      word_start: { type: integer }
+                      word_end: { type: integer }
+                    description: 仅在部分查询口径下返回。
                   editor:
                     type: object
                     properties:
@@ -205,6 +213,14 @@ delete:
                   reply_count:
                     type: integer
                     description: 仅在部分查询口径下返回。
+                  sentence:
+                    type: object
+                    properties:
+                      book: { type: integer }
+                      paragraph: { type: integer }
+                      word_start: { type: integer }
+                      word_end: { type: integer }
+                    description: 仅在部分查询口径下返回。
                   editor:
                     type: object
                     properties:
@@ -394,6 +410,14 @@ patch:
                   reply_count:
                     type: integer
                     description: 仅在部分查询口径下返回。
+                  sentence:
+                    type: object
+                    properties:
+                      book: { type: integer }
+                      paragraph: { type: integer }
+                      word_start: { type: integer }
+                      word_end: { type: integer }
+                    description: 仅在部分查询口径下返回。
                   editor:
                     type: object
                     properties:

+ 22 - 1
openapi/public/assets/protocol/resources/auto/v3-discussions.yaml

@@ -8,7 +8,8 @@ get:
     只列话题(不含回复),删除了但还有回复的话题以墓碑出现(deleted_at 有值、内容为空)。
     未登录看不到不公开的话题(discussion);basic 角色在自己无权管理的对象上只看得到
     自己发起的不公开话题。各状态的数量与「能发起哪些类型」见 `GET /v3/discussions/summary`。
-    不传 type 时只列评论线程(discussion / qa / help / issue),批注要显式 type=note / commentary。
+    不传 type 时只列评论线程(discussion / qa / help / issue / glossary),批注要显式 type=note / commentary。
+    要一段经文(一章、一段段落区间)里的全部话题,用 `GET /v3/tipitaka-discussions/{channel}`。
 
     实现:`V3\DiscussionController@index`
   security:
@@ -156,6 +157,10 @@ get:
                     reply_count:
                       type: integer
                       description: 仅在部分查询口径下返回。
+                    sentence:
+                      type: object
+                      properties: { book: { type: integer }, paragraph: { type: integer }, word_start: { type: integer }, word_end: { type: integer } }
+                      description: 仅在部分查询口径下返回。
                     editor:
                       type: object
                       properties: { id: { type: string }, nickName: { type: string }, userName: { type: string }, realName: { type: string }, sn: { type: integer }, avatar: { type: string }, roles: { type: array, items: { type: string } } }
@@ -331,6 +336,14 @@ post:
                   reply_count:
                     type: integer
                     description: 仅在部分查询口径下返回。
+                  sentence:
+                    type: object
+                    properties:
+                      book: { type: integer }
+                      paragraph: { type: integer }
+                      word_start: { type: integer }
+                      word_end: { type: integer }
+                    description: 仅在部分查询口径下返回。
                   editor:
                     type: object
                     properties:
@@ -428,6 +441,14 @@ post:
                   reply_count:
                     type: integer
                     description: 仅在部分查询口径下返回。
+                  sentence:
+                    type: object
+                    properties:
+                      book: { type: integer }
+                      paragraph: { type: integer }
+                      word_start: { type: integer }
+                      word_end: { type: integer }
+                    description: 仅在部分查询口径下返回。
                   editor:
                     type: object
                     properties:

+ 188 - 0
openapi/public/assets/protocol/resources/auto/v3-tipitaka-discussions-channel.yaml

@@ -0,0 +1,188 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-tipitaka-discussions-channel.yaml
+get:
+  summary: 列出一段经文里的话题
+  tags:
+    - tipitaka-discussions
+  operationId: get_api_v3_tipitaka_discussions_channel_
+  description: |-
+    只列挂在该 channel 句子上的话题(不含回复),按经文顺序(书、段、句)排列,同一句里按时间;
+    每条带 `sentence`(所在句子的坐标)。删除了但还有回复的话题以墓碑出现。
+    不传 type 时只列评论线程(discussion / qa / help / issue / glossary),批注要显式
+    type=note / commentary。可见性同 `GET /v3/discussions`:未登录看不到 discussion;
+    basic 角色在自己不能编辑的 channel 上只看得到自己发起的 discussion。
+    channel 不存在或范围内没有讨论都返回空列表;chapter 不存在 404。
+
+    实现:`V3\TipitakaDiscussionController@__invoke`
+  security:
+    - {  }
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: channel
+      in: path
+      required: true
+      schema:
+        type: string
+      description: '句子所在 channel 的 uuid'
+    -
+      name: per_page
+      in: query
+      schema:
+        type: integer
+        default: 15
+      description: '每页数量,最大 200'
+    -
+      name: book
+      in: query
+      schema:
+        type: integer
+      description: '书号;与 chapter / para / to 一起用时必填,不传则是整个 channel'
+      example: 169
+    -
+      name: chapter
+      in: query
+      schema:
+        type: integer
+      description: '章节起始段落号,服务端按章节长度展开成段落区间;不能与 para / to 同用'
+      example: 893
+    -
+      name: para
+      in: query
+      schema:
+        type: integer
+      description: 起始段落号
+      example: 895
+    -
+      name: to
+      in: query
+      schema:
+        type: integer
+      description: '结束段落号(含),缺省同 para'
+      example: 896
+    -
+      name: type
+      in: query
+      schema:
+        type: string
+      description: 类型,逗号分隔多选;不传则只列评论线程
+      example: 'issue,glossary'
+    -
+      name: status
+      in: query
+      schema:
+        type: string
+        enum:
+          - active
+          - close
+      description: 话题状态,不传则两种都要
+    -
+      name: severity
+      in: query
+      schema:
+        type: string
+      description: 严重程度,逗号分隔多选
+      example: 'error,warning'
+    -
+      name: page
+      in: query
+      schema:
+        type: integer
+        default: 1
+      description: 页码
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: array
+                items:
+                  type: object
+                  properties:
+                    id:
+                      type: string
+                    target_type:
+                      type: string
+                    target_id:
+                      type: string
+                    parent_id:
+                      type: string
+                      nullable: true
+                    type:
+                      type: string
+                    severity:
+                      type: string
+                      nullable: true
+                    status:
+                      type: string
+                    title:
+                      type: string
+                      nullable: true
+                    content:
+                      type: string
+                      nullable: true
+                    content_type:
+                      type: string
+                    html:
+                      type: string
+                      description: 仅在部分查询口径下返回。
+                    summary:
+                      type: string
+                      description: 仅在部分查询口径下返回。
+                    tpl_id:
+                      type: string
+                      nullable: true
+                    pos_start:
+                      type: integer
+                      nullable: true
+                    pos_end:
+                      type: integer
+                      nullable: true
+                    quote_exact:
+                      type: string
+                      nullable: true
+                    quote_prefix:
+                      type: string
+                      nullable: true
+                    quote_suffix:
+                      type: string
+                      nullable: true
+                    reply_count:
+                      type: integer
+                      description: 仅在部分查询口径下返回。
+                    sentence:
+                      type: object
+                      properties: { book: { type: integer }, paragraph: { type: integer }, word_start: { type: integer }, word_end: { type: integer } }
+                      description: 仅在部分查询口径下返回。
+                    editor:
+                      type: object
+                      properties: { id: { type: string }, nickName: { type: string }, userName: { type: string }, realName: { type: string }, sn: { type: integer }, avatar: { type: string }, roles: { type: array, items: { type: string } } }
+                      nullable: true
+                    co_editor:
+                      type: object
+                      properties: { id: { type: string }, nickName: { type: string }, userName: { type: string }, realName: { type: string }, sn: { type: integer }, avatar: { type: string }, roles: { type: array, items: { type: string } } }
+                      nullable: true
+                    abilities:
+                      type: object
+                      properties: { update: { type: boolean }, delete: { type: boolean }, close: { type: boolean }, reply: { type: boolean } }
+                    created_at:
+                      type: string
+                    updated_at:
+                      type: string
+                    deleted_at:
+                      type: string
+                      nullable: true
+              meta:
+                $ref: '../../main.yaml#/components/schemas/PaginationMeta'
+    404:
+      description: 'chapter 不是本书存在的段落'
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'