-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
[BUG] [JAVA] Missing importing @Valid cause compilation issue on client creation #17617
Comments
can you please file a PR with the suggested fix? |
I also experienced this issue. But it is not valid for all generated files. The import for |
The same issue applies to using patterns on the strings in an array parameter, e.g.:
The generated Code includes a |
Seeing this same issue with 7.3.0 -- missing |
Issue appears to be limited to the generated DefaultApi class, for both resttemplate and webclient (have encountered it with at least these types of generated client). It looks as if parameters surfaced via the lines below can include the @Valid annotation when the operation takes an array of items with attributes that have a format (possibly pattern), and useBeanValidation is true: DIfficult to follow the flow of execution though, so I may be incorrect. |
I found the same Problem when upgrading from Generator:
I am using the
It breaks when generating path or query parameters with constraints for apis.
Starting from version
Generated code
Generated code
Generated code
My expectation would be that constraints are generated when defined in my api specification and the import is added properly. Please tell me if I am configuring something wrong here or if this is an actual bug. |
any updates on this ? |
I just found #18332 |
Bug Report Checklist
Description
When the query parameter type is declare in a different yaml file but imported as reference and when the type is Array of Enum, it was notice that the client generation produces a not compiling java code.
In the client code, the method argument matching the query parameter is now annotated with @Valid (this was introduced in the openapi version 7.2.0) however the class does not import the annotation resulting in a "cannot find symbol" compilation issue.
openapi-generator version
The version 7.2.0 introduced this issue.
OpenAPI declaration file content or url
Content of first.yaml file
Content of second.yaml file
Generation Details
openapi-generator-maven-plugin
configuration:
Suggest a fix
Include the missing "import jakarta.validation.Valid;" import in the generated client class.
The text was updated successfully, but these errors were encountered: