-
Notifications
You must be signed in to change notification settings - Fork 19
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
Single fielded oneof #118
Single fielded oneof #118
Conversation
…variants after those fields instead of with numbers. Fix up some utilities for consistency, and add a Field type instead of recomputing property names.
Hey @dfithian Generally, it is hard to give these types good names generically, so I do not see a way around some special casing (which we already have in place with the fixed value schemas). Your case looks reasonable to me, so I think this is an improvement as the indexed OneOf types are nearly useless. I even wonder if we should enable the option by default as it should only improve existing cases (having the flag though is good so peeps can revert to the previous version if needed). At least I'd be interested to see how the changes behave in the golden tests. Since you'll have to update the golden result anyway, would you mind also adding the flag here?
Could you also add a single field object schema outside a oneOf case to make it visible that the new code does not affect that? Thank you! |
I am happy to make it the default behavior. Would you like me to increment the version to 0.2.0.0 or would you prefer to handle any version rev? |
Yeah, let's increase the version 👍 |
…work 100% of the time.
Alright, tests are passing! |
Nice work, thank you @dfithian ! |
0eb15be
into
Haskell-OpenAPI-Code-Generator:master
@joel-bach
Not sure if this is the best way. At work using Rust's
aide
package we'll have a lot of enums like this:Which generate this:
Using this generator it tends to generate enumerations with a lot of
OneofN
suffixes, but with this feature it'll generate them withLeft
andRight
suffixes instead.