In Java, it is quite easy to create an Enum like
public enum EnumType {
TYPE_A ("Some text for type A"),
TYPE_B ("Some text for type B"),
TYPE_C ("Some text for type C")
}
I want to be able to create a similar structure with the OpenAPI specification.
This would be easy enough if the names and values are the same with :
openapi: 3.1.0
(...)
components:
schemas:
EnumType:
enum: [ TYPE_A,
TYPE_B,
TYPE_C
]
But how can I do it with OpenAPI? IntelliJ will not allow the const property in the snippet below, saying it is prohibited.
openapi: 3.1.0
(...)
components:
schemas:
EnumType:
oneOf:
- title: TYPE_A
const: 'Some text for type A'
- title: TYPE_B
const: 'Some text for type B'
- title: TYPE_C
const: 'Some text for type C'
Thanks in advance,
constkeyword which is new in 3.1.enumwithx-extensions (like here) and customize the code generator to understand those extensions (assuming your codegen supports such customizations).