Openapi-specification: Decimal type is missed for number format. What is a reason?

Created on 26 Mar 2015  路  9Comments  路  Source: OAI/OpenAPI-Specification

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

Most helpful comment

Don't float and double cover that (and number in general)?

In general, it doesnt. We are building a banking application and decimal is what we only use for money.

All 9 comments

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.

ah. thanx a lot

Don't float and double cover that (and number in 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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ePaul picture ePaul  路  5Comments

jblazek picture jblazek  路  3Comments

rocchisanijl picture rocchisanijl  路  5Comments

mission-liao picture mission-liao  路  3Comments

duckladydinh picture duckladydinh  路  4Comments