You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is there is a way to merge enums into one flat enum, or list? #1320
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 @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?
Hello, just found this because I was searching for another solution than doing this solution of the oneOf. Just wanted to say that it's working for me at the condition I specify the type at the oneOf level too :
Activity
hkosova commentedon Aug 15, 2017
YAML does not support this.
In OpenAPI 3.0 this can probably be handled using
oneOf:nomadtechie commentedon Aug 15, 2017
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?
hkosova commentedon Aug 16, 2017
Yes. In 3.0, all parameters use a
schema, so the syntax would be similar to models:Correct.
oneOfis a new feature in 3.0.riba2101 commentedon Oct 29, 2020
just a note - this does not work, the resulting
Coloris an empty class, also there is a bug if you useallOfthe parent extends the enum.the above mentioned is valid for java generator
idromigny commentedon Feb 12, 2021
Hello, just found this because I was searching for another solution than doing this solution of the
oneOf. Just wanted to say that it's working for me at the condition I specify thetypeat theoneOflevel too :I'm using this for
queryparameter though. Don't know if it's changing anything about the fact that's working.