-
Notifications
You must be signed in to change notification settings - Fork 92
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
Added the FQCN to the @Size-annotation. #975
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think post-processing the generated models is unnecessary and it's merely a configuration issue.
After reporting this bug, I've dropped this project and used OpenAPI Generator directly to generate the respective models.
This is the working configuration:
annotationLibrary: "none"
asyncNative: true
dateLibrary: "java8"
disableMultipart: true
documentationProvider: "none"
generateBuilders: true
hideGenerationTimestamp: true
library: "microprofile"
microprofileMutiny: true
microprofileRestClientVersion: "3.0"
openApiNullable: false
serializationLibrary: "jackson"
useBeanValidation: true
useJakartaEe: true
useRuntimeException: true
The missing piece is probably microprofileRestClientVersion: "3.0"
and potentially useJakartaEe: true
.
https://github.com/OpenAPITools/openapi-generator/blob/v7.11.0/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java#L289
@joschi @denvitaharen, then we can set/expose these configurations since it seems that the generator already sets the correct variables based on the set of properties. |
From my own experience with the OpenAPI generator (I have used it my self before changing to this), the My understanding of this extension is that it doesn't use the OpenAPI generator to generate the classes, the OpenAPI generator is used to convert the OpenAPI file to an set of java objects which then is pass to the Qute template engine that generates the java classes. Of course, I tried this and I removed my post processing and added the configuration, but made no difference and we where back to square one with an |
This is a simplified view of the world. In reality The custom templates of this extension are just incomplete with regards to these generated parts of the code. In other words: The templates have to be fixed and be aligned with the upstream Mustache templates if you still want to use the upstream code generator. I've updated #926 with the fixed template. |
Indeed, a review of Qute templates to follow some mustache changes might be needed. But please remember that the files generated here aim to be closer to the Quarkus Ecosystem. |
[0.9.x] Subject
Thanks to @ricardozanini for pointing me in the right direction.
The solution is to post process the models and find the
@Size
annotation and replace them with the FQCN instead.This fixed bug: #925
I took the update from #926 that @joschi made to reproduce the problem and used it to verify that the fix works. So that pull request can be closed when this is merge.
I tried to write an test to verify that the Size annotation is there, but since the Size annotation is not on the variable
listOfStrings
but rather on the type of the list, I can't really understand how I can check that.