For the complete documentation index, see llms.txt. This page is also available as Markdown.

描述枚举

了解如何为枚举添加描述

当 API 操作包含枚举时,您可以添加 x-enumDescriptions 以便为每个选项提供更多上下文。GitBook 会在该操作旁边的表格中显示枚举值及其描述。

openapi.yaml
openapi: '3.0'
info: ...
components:
  schemas:
    project_status:
      type: string
      enum:
        - LIVE
        - PENDING
        - REJECTED
      x-enumDescriptions:
        LIVE:项目已上线。
        PENDING:项目待批准。
        REJECTED:项目已被拒绝。

最后更新于

这有帮助吗?