Skip to content

Additional properties for describing restrictions on number values #602

@ralfhandl

Description

@ralfhandl

Sometimes the data provided or accepted by an API ultimately resides in a (relational) database, and most databases have a NUMBER type that allows storing numbers with decimal mantissa. The potential values of a NUMBER column are restricted by

  • precision: number of significant decimal digits
  • scale: the place where the decimal point resides, counted from the right

This can of course be expressed with minimum, maximum, and multipleOf, e.g.

minimum: -9999999.999
maximum: 9999999.999
multipleOf: 1e-3

Yet it would be nicer to just say

precision: 10
scale: 3

This could also be used for DECFLOAT values:

precision: 34
# scale is variable

is a long DECFLOAT, the short one would have precision: 16

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