-
Notifications
You must be signed in to change notification settings - Fork 84
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
Union type support broken #289
Comments
Ok, problem seems to occur when description is missing. types:
boolOrString:
description: test
type: string | boolean |
Hi @Phil-Ba, Thanks for reporting the issue. TBH, I'm not sure how generated code should look like in this case. |
I think there are at least two ways we can implement union types in Java. They are both not perfect but viable when type is used as a request or response body. However query parameter is a different story, I'm at loss there too. So first approach is to create a field and an accessor for each type of the union. This is similar to how plugin works right now (see raml-with-union-types), but there are some problems when types extend other user-defined types (#298).
Another approach, currently implemented in mulesoft-labs/raml-for-jax-rs, is to use a single field and provide accessors with type checking and casting. I haven't tried this myself and not sure deserialization would work.
|
Let's go with the second approach - the one used in |
Currently trying to use union types leads to a NullPointerException:
Example:
The text was updated successfully, but these errors were encountered: