-
-
Notifications
You must be signed in to change notification settings - Fork 15
[REQ][python] Allow type: number format: float to ingest json integers #426
Comments
Can you please give an example schema and payload that is failing? Do you mean json schema number type with float as the format? With or without formatting? |
Hmm I see that ingesting 0 is failing for format float and double ingestion.
and
And both the java and python generators impose this type constraint. |
The openapi format registry defines float as: My suspicion is that float and double formats should allow integers in by default because some language contexts (javascript) do not know the difference. One could add a command line option |
We get the same error message in our use case.
Just using
Independent of our problem, having such flag could give the user more flexibility but with a certain cost of adjusting the type definition as you said. Additionally, I could think of use cases where such flag is suitable and with making it optional, the default behavior will not change. The error message is still correct as ingesting a |
I just released version 4.3.0 which includes the command line arg
The value is defaulting to false right now to not break legacy code. In the next major release (5.0.0) I will change its default value to true so the defaults will allow normal json schema validation. |
Thanks for your work :) |
You're welcome |
Is your feature request related to a problem? Please describe.
We currently face validation errors when facing
0
values for a required float type. We would like to handle these values as floats. Our backend is written in Typescript which makes it impossible to save a value0.0
because it will transformed to0
.Describe the solution you'd like
It exists an closed issue for the related python generator in the
openapi-generator
library. The corresponding fix is in this MR.Is it possible to have a similar additional flag that allows such a strict behavior?
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: