-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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/Spring] Openapi Generator 7.4.0 generates Integer Min and Max Values for int64 array instead of Long Values causing compile errors #18082
Comments
I have the bug too and can confirm that the character 'L' is missing for the constants. |
Is there any solution for this bug? Or we have to handle this manually. Is it a bug introduced by the template file? |
can you try openapi generator v7.3.0 as a workaround to see if it works for you? |
It's not work for me sadly, the type is This seems to be related to the nesting defined in yaml. The first one takes effect but the second one does not. the one that works: properties:
vm_id:
type: integer
format: int64
minimum: 100
maximum:99999999999999 @javax.annotation.Nonnull
@NotNull
@Min(100L) @Max(9999999999999L)
public Long getVmId() {
return vmId;
} the one that doesn't works properties:
vm_ids:
type:array
items:
type: integer
format: int64
minimum: 100
maximum:9999999999999 @SerializedName(SERIALIZED_NAME_VM_IDS)
private List<@Min(100) @Max(9999999999999)Long> vmIds; |
Hi. Works fine with 7.3.0,as the min and max values are not generated for arrays there with the spring generator. |
Same case, for arrays it does not work in 7.3.0, for objects it does.
|
if anyone would like to contribute or sponsor a fix, please reply to let us know. thank you. |
It seems easy to resolve this bug. I'm already found the code causes this. I will try to fix this today. |
thanks @fanqiewanzi for the fix, which has been merged |
Bug Report Checklist
Description
Since version 7.4.0 arrays of int64 items with defined min and max values are generated with @min and @max annotations.
The values are generated as Integer instead of Long. which results in "integer number too large" errors.
Generated code:
openapi-generator version
Since 7.4.0
OpenAPI declaration file content or url
Generation Details
pom - Plugin
Steps to reproduce
Generate via maven plugin results in
Suggest a fix
Generate Min and Max Value as Long values instead, as for normal int64 fields.
Expected Output:
The text was updated successfully, but these errors were encountered: