Skip to content
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

Type: number, Format: float becomes a double in C# #1122

Closed
martinmolin opened this issue Jan 2, 2018 · 4 comments · Fixed by RicoSuter/NJsonSchema#1121
Closed

Type: number, Format: float becomes a double in C# #1122

martinmolin opened this issue Jan 2, 2018 · 4 comments · Fixed by RicoSuter/NJsonSchema#1121

Comments

@martinmolin
Copy link

According to https://swagger.io/docs/specification/data-models/data-types/

type format Description
number Any numbers.
number float Floating-point numbers.
number double Floating-point numbers with double precision.
integer Integer numbers.
integer int32 Signed 32-bit integers (commonly used integer type).
integer int64 Signed 64-bit integers (long type).

There can be floats as well as doubles, however for the C# generator it seems like both float and double will end up being a double.

@francesco-scullino
Copy link

Any news?

@RicoSuter
Copy link
Owner

BTW: Double and float seem to be not defined format types for JSON Schema: https://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3

@orihomie
Copy link

orihomie commented Jan 9, 2020

There's another problem with float and double and its about this types scopes - they can be Infinity or NaN, but generated json schema points them as "number" only.
I think its could be a problem when casting json types onto C# Dto objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants