cancel
Showing results for 
Search instead for 
Did you mean: 

Swagger Enum Deprecated Values- Is it possible?

SOLVED
Highlighted
New Member

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 error bad indentation of a sequence entry 

 

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator

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

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

1 REPLY 1
Highlighted
Moderator

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

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements