v3-markup-previews.yaml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-markup-previews.yaml
  2. post:
  3. summary: 预览一段源码
  4. tags:
  5. - markup-previews
  6. operationId: post_api_v3_markup_previews
  7. description: |-
  8. 把还没保存的 markdown 渲染成节点树(与术语、批注的 `body` 同形),不写库,所以是 200 而不是 201。
  9. 口径同阅读页的读模式:术语按第一个 channel 查,句子模板缺省读这些 channel 的译文。
  10. 给了 `channels` 的,每个都要有读权限:不存在 404,看不见 403。
  11. 实现:`V3\MarkupPreviewController@__invoke`
  12. security:
  13. -
  14. bearerAuth: []
  15. requestBody:
  16. required: true
  17. content:
  18. application/json:
  19. schema:
  20. type: object
  21. properties:
  22. content:
  23. type: string
  24. description: '源码,最多 20000 字'
  25. content_type:
  26. type: string
  27. description: 方言
  28. enum:
  29. - markdown
  30. - markdown-e2
  31. default: markdown
  32. channels:
  33. type: array
  34. description: '内容所属的 channel uid,最多 10 个'
  35. lang:
  36. type: string
  37. description: '没给 channel 时用的语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果)'
  38. required:
  39. - content
  40. responses:
  41. 200:
  42. description: 成功
  43. content:
  44. application/json:
  45. schema:
  46. type: object
  47. properties:
  48. data:
  49. type: object
  50. properties:
  51. body:
  52. type: array
  53. items:
  54. $ref: '../../main.yaml#/components/schemas/MarkupNode'
  55. 401:
  56. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  57. 403:
  58. description: '给的 channel 没有读权限'
  59. content:
  60. application/problem+json:
  61. schema:
  62. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  63. 404:
  64. description: '给的 channel 不存在'
  65. content:
  66. application/problem+json:
  67. schema:
  68. $ref: '../../main.yaml#/components/schemas/ProblemDetails'
  69. 422:
  70. $ref: '../../main.yaml#/components/responses/ProblemValidation'