Forum Discussion

vg's avatar
vg
New Member
4 years ago
Solved

Swagger Enum Deprecated Values- Is it possible?

Is it possible to deprecated values of enum? if so what is the syntax. I tried adding deprecated: true inside enum  enum: - test1 - test2 deprecated: true - test3 But build fails with erro...
  • HKosova's avatar
    4 years ago

    This is not possible in the current version of the OpenAPI Specification.

    But in the next version, OpenAPI 3.1, you will be able to define this by using oneOf + const + deprecated:

    MyEnum:
      oneOf:
        - const: test1
        - const: test2
          deprecated: true
          description: Use test3 instead
        - const: test3