-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[jaxrs-resteasy/anyOf] code generator doesn't generate good java classes for types based on anyOf #559
Comments
Hi, Is there any update on this issue? Also, I think it may be a duplicate / related to #798 Thanks |
This is a common problem in all swagger generators. Basically, if you're using OAS, design your API to provide consistent responses. |
Unfortunately this is not always possible. In this case, the API is defined by the 3GPP standards body as part of the 5G core standards. |
Okay it is working for my use-case with: <openapiNormalizer>
SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING=true
</openapiNormalizer> |
Description
When a declared type is based on an anyOf, the generated java class owns no attribute, just default methods from Object class.
It leads to an error at runtime because the json value can't be bound to its bean class by jaxrs framework.
anyOf declaration seems to not be supported by code generator while it is part of OpenApi 3 standard.
openapi-generator version
openapi-generator-cli-3.1.0.jar
OpenAPI declaration file content or url
The file TS29571_CommonData.yaml contains this declared defintion RatType
which is used in file TS29518_Namf_MT.yaml
Command line used for generation
We suppose the file openapi-generator-cli-3.1.0.jar is in the current folder
and yaml files in a folder named yaml
rm -fr target/samples.openapi && java -jar ./openapi-generator-cli-3.1.0.jar generate -i yaml/TS29518_Namf_MT.yaml -g jaxrs-resteasy -o target/samples.openapi
Steps to reproduce
The issue has been found at runtime. It means we should need to build a war or jar file and put in its given runtime environment. These steps will take time.
A quickest solution to look to the issue is to open the generated class file RatType.java which looks like this:
As we can see there is no attribute in this generated class. Some pieces of code miss.
Related issues/PRs
Suggest a fix/enhancement
The fix should generates the source code related to the attributes defined in the OpenApi file.
yaml.zip
The text was updated successfully, but these errors were encountered: