You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
We are using openapi-generator maven plugin's spring generator to generate code from openapi specification (yaml). Because pf the rounding issues we map the float fields to BigDecimal data type using TypeMapping as suggested in #5587
In most of the cases it works fine, but for one of the affected float fields of the spec also a default value is defined (default: 1). In the generated code the field has BigDecimal type as expected, but the float value "1f" is assigned which leads to a compilation error.
Expected would be to use BigDecimal.ONE or such as default value.
openapi-generator version
6.0.1
OpenAPI declaration file content or url
We are using maven plugin which has the configuration below
Quantity:
type: object
description: An amount in a given unit
properties:
amount:
default: 1
type: number
format: float
description: Numeric value in a given unit
units:
type: string
description: Unit
Generate sources from a such specification and the result is
Bug Report Checklist
Description
We are using openapi-generator maven plugin's spring generator to generate code from openapi specification (yaml). Because pf the rounding issues we map the float fields to BigDecimal data type using TypeMapping as suggested in #5587
In most of the cases it works fine, but for one of the affected float fields of the spec also a default value is defined (default: 1). In the generated code the field has BigDecimal type as expected, but the float value "1f" is assigned which leads to a compilation error.
Expected would be to use BigDecimal.ONE or such as default value.
openapi-generator version
6.0.1
OpenAPI declaration file content or url
We are using maven plugin which has the configuration below
pluginManagement:
plugins:
Generation Details
S. above
Steps to reproduce
Used openapi-spec field definition:
Generate sources from a such specification and the result is
Related issues/PRs
For Kotlin the same issue already fixed:
#10866
Suggest a fix
Use a "new BigInteger()" as default
The text was updated successfully, but these errors were encountered: