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

international money amount and currency #2

Closed
pvdbosch opened this issue Feb 1, 2021 · 5 comments
Closed

international money amount and currency #2

pvdbosch opened this issue Feb 1, 2021 · 5 comments

Comments

@pvdbosch
Copy link
Contributor

pvdbosch commented Feb 1, 2021

Support international money amounts by defining:

  • a Currency type
  • a type for the numerical money amount

To determine final naming of the types, an issue in fedvoc repo will be created.

For Currency, base on https://en.wikipedia.org/wiki/ISO_4217#Active_codes

Currency:
  type: string
  pattern: ^[A-Z]{3}$
  example: EUR

For amount:

  • representation of decimals => see representation of decimal numbers rest-guide#79
  • money amount can, according to the ISO codes, have 0 up to 4 decimal digits. Expressing the amount as integers is tricky then because you need to know where to place the comma
  • EuroCentAmount can still be kept for use cases (APIs) where the currency is always Euro
  • It is common that negative amounts are not allowed for a use case. We could, similarly to EuroCentPositiveAmount, create an additional type that only allows for positive amounts.

We could create an additional Money type to combine Currency and MoneyAmount in a composite type (also PositiveMoney then?)

For comparison: Zalando Money type.

@pvdbosch
Copy link
Contributor Author

pvdbosch commented Aug 4, 2021

current draft for international money types, based on updated FedVoc draft in belgif/fedvoc#17

    Currency: # do we add Code suffix?
      description: A currency represented by its ISO 4217 alpha code
      type: string
      pattern: "^[A-Z]{3}$"
      example: "EUR"
    MonetaryAmount:
      description: A monetary value
      type: object
      properties:
        value:
          "$ref": "#/components/schemas/Decimal"
        currency:
          "$ref": "#/components/schemas/Currency"
      required: [value, currency]
      example:
        value: "0.01"
        currency: "EUR"

discussion on Decimal type is continued in belgif/rest-guide#79

@pvdbosch
Copy link
Contributor Author

pvdbosch commented Oct 29, 2021

approved by REST functional WG, still to be approved by technical WG; MonetaryAmount only after solution for Decimal type

@pvdbosch
Copy link
Contributor Author

pvdbosch commented Feb 4, 2022

types were updated after REST design WG discussion in belgif/rest-guide#79

Can be re-validated by both functional and technical WGs.

@pvdbosch
Copy link
Contributor Author

pvdbosch commented Feb 4, 2022

validated by functional WG

@pvdbosch
Copy link
Contributor Author

pvdbosch commented Apr 1, 2022

openapi-money 1.0.1 has been released with the types graduated to stable status.

@pvdbosch pvdbosch closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant