Support for Decimal (monetary) data
See original GitHub issueRelated to: https://github.com/OAI/OpenAPI-Specification/issues/1517
Here is a printout from Open Banking in the UK. “Amount” is the field of interest.
HTTP/1.1 200 OK
x-fapi-interaction-id: 93bac548-d2de-4546-b106-880a5018460d
Content-Type: application/json
{
"Data": {
"DirectDebit": [
{
"AccountId": "22289",
"DirectDebitId": "DD03",
"MandateIdentification": "Caravanners",
"DirectDebitStatusCode": "Active",
"Name": "Towbar Club 3 - We Love Towbars",
"PreviousPaymentDateTime": "2017-04-05T10:43:07+00:00",
"PreviousPaymentAmount": {
"Amount": "0.57",
"Currency": "GBP"
}
}
]
},
"Links": {
"Self": "https://api.alphabank.com/open-banking/v2.0/accounts/22289/direct-debits/"
},
"Meta": {
"TotalPages": 1
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Use the DECIMAL Data Type for Money Values - Vertabelo
Find out which data type should be used for money values in SQL!
Read more >Model Monetary Data — MongoDB Manual
Applications that handle monetary data often require the ability to capture fractional units of currency and need to emulate decimal rounding with exact ......
Read more >Decimal Safety Right on The Money - FP Complete
We developed a library for operating on decimal numbers that guards you from errors. Come learn how it works and how you can...
Read more >Money and Decimal Data Types for Monetary Values with SQL ...
In this article, we look at the differences between storing monetary values in SQL Server using the money data type versus the decimal...
Read more >Which data type would you choose for storing currency values ...
Primitive type — int and long are also useful for monetary calculations if decimal precision is not required. We should really avoid using ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cyberphone Yes. Here is the ANBF grammar for how to serialize a JSON Number over the wire in UTF-8 text.
And your last comment gets to the heart of the matter. OpenAPI is not in the business of telling people how to serialize data. That is the job of media type specifications. We are in the business of trying to describe in a platform independent manner what people chose to do.
Sure, I’m unarguable NOT an expert on OpenAPI and JSON Schema. I did though read the table of data types: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#data-types I found
dateTime
and saw that it is mapped into RFC3339 formatted “strings”.I would reuse that idea for Decimal unless there is something fundamentally wrong with doing that. The W3C folks’ format specification would probably suffice.