Hello,
I am developing a swagger documentation for our API and encountered with misunderstanding:
Decimal type is missed for number format.
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types
It is very important for us to use Decimal type because of we work with financial systems.
Is it possible to include Decimal type to the spec?
Thank you
Don't float and double cover that (and number in general)?
i believe (and this may not be what's in the swagger spec), that number without a format implies decimal
There is one more type is used in .Net.
The float keyword signifies a simple type that stores 32-bit floating-point values
The double keyword signifies a simple type that stores 64-bit floating-point values.
The decimal keyword indicates a 128-bit data type.
Now we don't have a way to understand what a type exactly we have to expect.
The specification can't relate to specific data types in specific languages. Is decimal in .Net fixed or floating point?
The spec does allow you to use whichever format you want, so if you want to call it float128bit or decimal, you can. It doesn't mean the tools will be able to parse it automatically though. As for the type, it's definitely number in this case.
Decimal is a floating point.
"The spec does allow you to use whichever format you want"
Cool. Where i can read about this? Developers which create frameworks strongly follow to spec instruction.
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types, third paragraph.
ah. thanx a lot
Don't
floatanddoublecover that (andnumberin general)?
In general, it doesnt. We are building a banking application and decimal is what we only use for money.
@fatagun , WebApiClientGen has supported decimal inherently for C# and TypeScript. since Swagger lacking of support for decimal, generic and tuple etc. was the primary reason why I had developed WebApiClientGen since 2015.
Most helpful comment
In general, it doesnt. We are building a banking application and decimal is what we only use for money.