Represent primitive types as JSON Schema formats

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

      Applied

      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

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

              Created:
              Updated:
              Resolved: