Skip to content

Request: Add precision and scale keywords for numeric instances #1123

@SrikrishnanS

Description

@SrikrishnanS

We often see use cases, where numeric values should have exactly n digits after decimal point. Example currency value should have 2 decimal places only:
{"price": 17.23}

Suggestion is to include precision and scale keywords in the spec. Precision is defined as number of digits in a number and scale is number of digits after decimal point.

I understand that scale can be achieved using multipleOf keyword, i.e. "multipleOf" : 0.01 ensures scale value 2, and "maximum": 999999 ensures precision value 6.

However precision and scale keywords should be meaningful and much cleaner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalInitial discussion of a new idea. A project will be created once a proposal document is created.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions