Skip to content

Type for money #889

Closed
Closed

Description

@worldmind

For money params we need special type, in Python, for example, it named decimal, PostgreSQL has numeric type.

Activity

  1. darrelmiller commented on Feb 24, 2017

    @darrelmiller
    Member

    The semantics of decimal can be added using the format property. It will be included in the format registry that we will be creating #845

  2. spacether commented on Sep 7, 2022

    @spacether

    For context here openapi-generator does this for python decimal.Decimal amounts with:

    type: string
    format: number
    
  3. karenetheridge commented on Sep 11, 2022

    @karenetheridge
    Member

    I could almost see a "number" format being useful, to specify strings that contain numeric data, but there's so many ways of representing a number, and some of them might not be suitable for a particular application. Also some numeric representations aren't practical in some languages.

    For example, one could start out defining a number format as "any string that can be converted to a number in my language" -- so for perl, the easy way of implementing that is with looks_like_number, which handles values like "2.0", "2.5", "2e-3", "Inf" and "NaN" - but doesn't handle "0xDEADBEEF" or "0x1.23p-4" or "0 but true" (which are all treated internally as numbers without warning). Or in C, one could use atoi() but that doesn't match many numeric forms cleanly either.

    tldr: formats like this are best defined locally to an application using a definition, so it can be tailored to the exact needs of that application, framework and language.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions