-
Notifications
You must be signed in to change notification settings - Fork 89
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
Additional properties support #66
Comments
Hey, @antssilva96, please open a PR with your changes. They are more than welcome! :) Additional properties were suppressed because, in the Quarkus context, they might not make sense. But in some cases, I understand that some of these properties should be supported via our prefix. We can add them on demand based on the use case. If the property is applied in codegen phase, use the prefix |
Hmm reading again the issue you linked, maybe we can fix this the Quarkus way? What's happening in your case? The import is being generated every time? I think you can remove this import for good in the QuarkusJavaClientCodegen If that doesn't make sense, you can add as a property like I mentioned above: |
Hi @ricardozanini thanks for your time! Can you elaborate a bit on
I'm fairly new to Quarkus and might be missing the bigger picture 😛 Regarding my issue, I'm getting
It is generated every time for the same Model classes. It seems to be present only if the spec of that model had a field with Both I tried checking the code and I do not find where the parsing of |
Meanwhile I opened a PR with the other fix, that is independent from this discussion: |
Thank you! We've merged, and I'll release a patch version right now.
Well, some of the properties of the internal generator might not make sense in the context of the extension just because the original generator runs as a maven plugin and this extension runs in Quarkus Codegen build. It's similar but different :) Additionally, we have our own template engine. Some properties there might not make sense here.
Hmm, I see. In this case, I think our templates are not registering these annotations. Well, we have some work to do then:
Do you think you can handle this PR? Many thanks! :) |
I'll take a shot ! One question,
I'm still unsure if this is something we want hardcoded for all use cases. For my openapi spec the import was added but the JsonNullable class was unused. How can we be sure this is the case for every spec? If it was I think the property added in the PR I originally linked was not needed in the first place, it could just be forced in the generator instead of an opt in functionality. What do you think ? Currently it feels like fields with |
Hi @ricardozanini ! Regarding the "unused" import... After some digging we figured that the problem is that the quarkus generator is using its own template (model.qute and pojo.qute) where imports are retrieved from JavaClientCodegen which gets them from AbstractJavaCodegen. So, without the new property set to false, we are including the import but our (quarkus openapi generator) templates do not use it. The solution is indeed adding the property where you linked above. Regarding the second part, of adding the @JsonInclude(Include.NON_NULL) annotation doesn't make sense for us. The nullable openapi spec definition is that the value may be null. Since we're generating everything in wrapper class return types (no primitives) callers already "know" these may be null. I'll open the PR to add the property. The other alternative would be to modify the mode.qute to exclude that import if it is present, but I think the property is more elegant. |
Yes, indeed. You're right. I thought from the spec side, whereas aligning the Jackson annotation would make sense. And yes, since we are wrapping the types, wouldn't make sense to add it. |
Thanks for the help, I think we can close this issue now! |
Hey guys, I just stumbled upon this extension and it is exactly what I need!
Thank you for your effort in creating this!
However due to the issue reported in OpenAPITools/openapi-generator#2901 I have to provide an additional property to be able to generate the sources. The property is the outcome of the issue linked above:
openApiNullable=false
.I took the liberty of forking the project and implementing the missing functionality in https://github.com/antssilva96/quarkus-openapi-generator/tree/add-additional-properties-support (also fixed what seems like a typo sort of bug in the template for the Authentication Provider).
I wanted to know if not allowing for additional properties was a design decision and if there is some other way of passing the mentioned property. If it was just a missing feature I'll be happy to create a pull request
The text was updated successfully, but these errors were encountered: