cancel
Showing results for 
Search instead for 
Did you mean: 

Swagger Enum Deprecated Values- Is it possible?

SOLVED
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

Re: Swagger Enum Deprecated Values- Is it possible?

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
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

1 REPLY 1
Highlighted
Moderator

Re: Swagger Enum Deprecated Values- Is it possible?

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
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

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