Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-842

Represent primitive types as JSON Schema formats

    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

      Many OData primitive types are JSON Schema primitive types combined with a set of restrictions, e.g. Edm.Int64 is

      • "type":"integer",
      • "minimum":-9223372036854775808,
      • "maximum":9223372036854775807
        or Edm.Guid is
      • "type":"string",
      • "pattern":"^[0-9a-fA-F] {8}

        -[0-9a-fA-F]

        {4}-[0-9a-fA-F]{4}

        -[0-9a-fA-F]

        {4}

        -[0-9a-fA-F]

        {12}

        $"

      There are basically three options:
      1) place these in definitions in edm.json and reference them there
      2) inline these definitions at each occurrence of the OData primitive type
      3) just combine the JSON Schema primitive type with an OData-specific format, e.g.

      • type: string
      • format: guid
        or
      • type: integer
      • format: int64

      The third approach is the most readable and in sync with what Swagger does, see http://swagger.io/specification, section Data Types, and we can try to get these formats into the next version of JSON Schema, see https://github.com/json-schema/json-schema/wiki/%22format%22-suggestions

        Attachments

          Activity

          handl Ralf Handl created issue -
          handl Ralf Handl made changes -
          Field Original Value New Value
          Proposal Define specific formats for OData primitive types
          Description Many OData primitive types are JSON Schema primitive types combined with a set of restrictions, e.g. Edm.Int64 is
          - "type":"integer",
          - "minimum":-9223372036854775808,
          - "maximum":9223372036854775807
          or Edm.Guid is
          - "type":"string",
          - "pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"

          There are basically three options:
          - place these in definitions in edm.json and reference them there
          - inline these definitions at each occurrence of the OData primitive type
          - just combine the JSON Schema primitive type with an OData-specific format, e.g.
          - type: string
          - format: guid
          or
          - type: integer
          - format: int64

          The third approach is the most readable and in sync with what Swagger does, see http://swagger.io/specification, section Data Types
          Many OData primitive types are JSON Schema primitive types combined with a set of restrictions, e.g. Edm.Int64 is
          - "type":"integer",
          - "minimum":-9223372036854775808,
          - "maximum":9223372036854775807
          or Edm.Guid is
          - "type":"string",
          - "pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"

          There are basically three options:
          - place these in definitions in edm.json and reference them there
          - inline these definitions at each occurrence of the OData primitive type
          - just combine the JSON Schema primitive type with an OData-specific format, e.g.
          - type: string
          - format: guid
          or
          - type: integer
          - format: int64

          The third approach is the most readable and in sync with what Swagger does, see http://swagger.io/specification, section Data Types, and we can try to get these formats into the next version of JSON Schema, see https://github.com/json-schema/json-schema/wiki/%22format%22-suggestions
          handl Ralf Handl made changes -
          Proposal Define specific formats for OData primitive types Define specific formats for OData primitive types:
          - uuid
          - date
          - time
          - duration
          - byte, int8, int16, int32, int64
          - double, single
          - base64url
          Description Many OData primitive types are JSON Schema primitive types combined with a set of restrictions, e.g. Edm.Int64 is
          - "type":"integer",
          - "minimum":-9223372036854775808,
          - "maximum":9223372036854775807
          or Edm.Guid is
          - "type":"string",
          - "pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"

          There are basically three options:
          - place these in definitions in edm.json and reference them there
          - inline these definitions at each occurrence of the OData primitive type
          - just combine the JSON Schema primitive type with an OData-specific format, e.g.
          - type: string
          - format: guid
          or
          - type: integer
          - format: int64

          The third approach is the most readable and in sync with what Swagger does, see http://swagger.io/specification, section Data Types, and we can try to get these formats into the next version of JSON Schema, see https://github.com/json-schema/json-schema/wiki/%22format%22-suggestions
          Many OData primitive types are JSON Schema primitive types combined with a set of restrictions, e.g. Edm.Int64 is
          - "type":"integer",
          - "minimum":-9223372036854775808,
          - "maximum":9223372036854775807
          or Edm.Guid is
          - "type":"string",
          - "pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"

          There are basically three options:
          1) place these in definitions in edm.json and reference them there
          2) inline these definitions at each occurrence of the OData primitive type
          3) just combine the JSON Schema primitive type with an OData-specific format, e.g.
          - type: string
          - format: guid
          or
          - type: integer
          - format: int64

          The third approach is the most readable and in sync with what Swagger does, see http://swagger.io/specification, section Data Types, and we can try to get these formats into the next version of JSON Schema, see https://github.com/json-schema/json-schema/wiki/%22format%22-suggestions
          handl Ralf Handl made changes -
          Issue Type Bug [ 1 ] Improvement [ 4 ]
          handl Ralf Handl made changes -
          Environment Proposed
          mikep Michael Pizzo (Inactive) made changes -
          Status New [ 10000 ] Open [ 1 ]
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          Resolved as proposed 2015-9-17

          Show
          mikep Michael Pizzo (Inactive) added a comment - Resolved as proposed 2015-9-17
          mikep Michael Pizzo (Inactive) made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          Questions:
          -Should we name the formats with an edm prefix (i.e., Edm.Guid) or not?
          ==>Since Swagger already defined guid, int64, etc., we should just add what is missing (w/o extensions)
          -If we specify a format, do we (for some types) also specify pattern (i.e., guid/uuid, time, datetimeoffset)?
          ==>open new issue

          Show
          mikep Michael Pizzo (Inactive) added a comment - Questions: -Should we name the formats with an edm prefix (i.e., Edm.Guid) or not? ==>Since Swagger already defined guid, int64, etc., we should just add what is missing (w/o extensions) -If we specify a format, do we (for some types) also specify pattern (i.e., guid/uuid, time, datetimeoffset)? ==>open new issue
          handl Ralf Handl made changes -
          Proposal Define specific formats for OData primitive types:
          - uuid
          - date
          - time
          - duration
          - byte, int8, int16, int32, int64
          - double, single
          - base64url
          Define specific formats for OData primitive types:
          - uuid
          - date
          - time
          - duration
          - uint8, int8, int16, int32, int64
          - double, single
          - base64url
          handl Ralf Handl made changes -
          Environment Proposed Applied
          handl Ralf Handl made changes -
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          Approved 2015-10-1

          Show
          mikep Michael Pizzo (Inactive) added a comment - Approved 2015-10-1
          mikep Michael Pizzo (Inactive) made changes -
          Status Applied [ 10002 ] Closed [ 6 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: