只读swagger枚举元素

时间:2019-04-03 09:59:18

标签: swagger openapi

是否可以将枚举列表条目定义为只读?现在我有

type: object
description: |
  VISA card
properties:
  id:
    type: integer
    description: Internal ID of the card.
    example: 1
    minimum: 1
    readOnly: true
status:
  type: string
  required: true
  description: Current status of the card.
  enum:
    - STATUS_ENABLED
    - STATUS_DISABLED
    - STATUS_DELETED # <-- I Want this to be read only!

现在在补丁操作中,我不想在上面重新定义,而是像这样使用它:

requestBody:
  description: VISA card data to be updated.
  required: true
  content:
    application/json:
      schema:
        $ref: ../../index.yaml#/components/schemas/VisaCard

但是,后面的API不允许将状态设置为STATUS_DELETED。该怎么做?

编辑:

为了澄清,PATCH应该只能使用STATUS_ENABLEDSTATUS_DISABLED

0 个答案:

没有答案