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

Allow @odata.type for isomorphy to CSDL XML

    XMLWordPrintable

    Details

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

      Applied

    • Proposal:
      Hide

      Re-opened 2018-9-27 and revised proposal:

      Within a $metadata document, control information (notably, @odata.type) is used in the same cases it would be used in a standard odata json response:

      1) in no metadata, no control information is returned

      2) in minimal metadata, control information (@odata.type) is returned for values whose type cannot be determined from metadata and cannot be heuristically determined 

      3) in full metadata, control information (@odata.type) must be returned for all types that cannot be heuristically determined (including entity or complex types)

      Show
      Re-opened 2018-9-27 and revised proposal: Within a $metadata document, control information (notably, @odata.type) is used in the same cases it would be used in a standard odata json response: 1) in no metadata, no control information is returned 2) in minimal metadata, control information (@odata.type) is returned for values whose type cannot be determined from metadata and cannot be heuristically determined  3) in full metadata, control information (@odata.type) must be returned for all types that cannot be heuristically determined (including entity or complex types)
    • Resolution:
      Show
      https://github.com/oasis-tcs/odata-csdl-schemas/pull/3 https://www.oasis-open.org/committees/download.php/64129/odata-csdl-json-v4.01-wd05-2018-10-22.docx  

      Description

      The XML representation of <EnumMember> constant expressions contains the enumeration type name of the enumeration value as a prefix:

      <Annotation Term="Namespace1_Alias.TermEnum">
        <EnumMember>Namespace1_Alias.ENString/String1 Namespace1_Alias.ENString/String3</EnumMember>
      </Annotation>

      The JSON representation does not contain the type name:

      "@com.odata.v4.technical.scenario.TermEnum": "String1,String3"
      

      This breaks isomorphy between XML and JSON representation of CSDL.

      The JSON representation was explicitly chosen without type prefix to mirror the JSON Format representation of enumeration values in data payloads.

      Allowing an @odata.type control information would both be consistent with JSON Format and establish isomorphy to CSDL XML:

      "@com.odata.v4.technical.scenario.TermEnum@odata.type": "#Namespace1_Alias.ENString",
      "@com.odata.v4.technical.scenario.TermEnum": "String1,String3"
      

      This should be optional in the normal case, required if you can't deduce the type; (i.e., if the term cannot be resolved for some reason or the type of the term is Edm.Untyped), as in the data payload.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: