Representation of Precision and Scale

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • V4.0_WD01
    • Affects Version/s: V4.0_WD01
    • Component/s: CSDL JSON
    • None
    • Environment:

      Applied

      JSON Schema offers the keywords minimum, maximum, and multipleOf for fine-tuning the value range of numeric properties.

      While it is possible to translate Precision="5" and Scale="2" into

      • multipleOf: 1e-2
      • minimum: -999.99
      • maximum: 999.99
        it is rather hard for an OData client to re-engineer the precision and scale

      Similar for temporal values: here Precision="7" would have to be -translated into a regular expression

      • "pattern":"(^[^.]*$|[.][0-9] {1,7}

        $)"

      We could add the original scale and precision as extension keywords.

      And we could additonally opt to omit the rather cryptic JSON Schema representation that would only benefit JSON Schema validators.

      For example a property of type Edm.TimeOfDay with precision 9 would be represented as

      {
      "type":"string",
      "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]

      {1,9}

      )?$",
      "precision":9
      }

            Assignee:
            Unassigned
            Reporter:
            handl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: