Details

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

      Applied

      Description

      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
      }

        Attachments

          Activity

          handl Ralf Handl created issue -
          handl Ralf Handl made changes -
          Field Original Value New Value
          Fix Version/s V4.0_WD01 [ 10247 ]
          Fix Version/s V4.01_WD01 [ 10276 ]
          handl Ralf Handl made changes -
          Affects Version/s V4.0_WD01 [ 10247 ]
          Affects Version/s V4.01_WD01 [ 10276 ]
          handl Ralf Handl made changes -
          Issue Type Bug [ 1 ] Improvement [ 4 ]
          handl Ralf Handl made changes -
          Environment Proposed
          handl Ralf Handl made changes -
          Status New [ 10000 ] Open [ 1 ]
          handl Ralf Handl made changes -
          Proposal Add OData-specific keywords "precision" and "scale" with numeric values
          Description 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.
          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
          }

          mikep Michael Pizzo (Inactive) made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          handl Ralf Handl made changes -
          Environment Proposed Applied
          handl Ralf Handl made changes -
          mikep Michael Pizzo (Inactive) made changes -
          Status Applied [ 10002 ] Resolved [ 5 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              handl Ralf Handl
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: