-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there is a way to merge enums into one flat enum, or list? #1320
Comments
YAML does not support this.
In OpenAPI 3.0 this can probably be handled using components:
schemas:
Colors1:
type: string
enum: [red, green, blue]
Colors2:
type: string
enum: [black, white]
Color:
oneOf:
- $ref: '#/components/schemas/Colors1'
- $ref: '#/components/schemas/Colors2' |
Thanks so much @hkosova! That is helpful for my models, but can I also use this for my path param? Also, I'm assuming there is no way to do this in OpenAPI 2.0? |
Yes. In 3.0, all parameters use a - in: path
name: color
required: true
schema:
oneOf:
- $ref: '#/components/schemas/Colors1'
- $ref: '#/components/schemas/Colors2'
Correct. |
just a note - this does not work, the resulting the above mentioned is valid for java generator |
Hello, just found this because I was searching for another solution than doing this solution of the
I'm using this for |
I am using the 2.0 spec and I have a field which I am using in a model as well as a path param where the value can be from one of three different enums. Using the syntax below is turning into an array with 3 enums. However, I would like it to be one flat enum. Is there any way to achieve this?
Thanks so much:
The text was updated successfully, but these errors were encountered: