Swagger OpenAPI 3.0:字段的可编辑性-动态

Swagger OpenAPI 3.0:字段的可编辑性-动态,swagger,openapi,Swagger,Openapi,是否可以在openapi 3.0中动态设置字段的可编辑性 以下是解决方法的一个示例: FooBar: description: | This type defines a type FooBar. type: object properties: myNumber: type: EditableNumber description: The number that should b

是否可以在openapi 3.0中动态设置字段的可编辑性

以下是解决方法的一个示例:

    FooBar:
      description: |
        This type defines a type FooBar.
      type: object
      properties:
        myNumber:
          type: EditableNumber
          description: The number that should be editable dynamically.

    EditableNumber:
      description: |
        This type defines an editable number.
      type: object
      properties:
        value:
          type: number
          description: The actual value
        editable:
          type: boolean
          description: whether the field is editable.
      required:
        - value
但这样做会更好:

    FooBar:
      description: |
        This type defines a type FooBar.
      type: object
      properties:
        myNumber:
          type: number
          description: The number that should be editable dynamically.
          readonly: true/false
但是真/假不能动态设置,对吗

或者,在没有解决办法的情况下,有没有其他可能做到这一点


谢谢

实际的用例是什么?例如,在这种情况下,字段可以通过POST进行修改,但不能通过补丁进行修改吗?用例是响应的使用者应该知道某个字段是否可以通过新请求进行修改。