Allow @odata.type for isomorphy to CSDL XML

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

      Applied

    • 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)
    • 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  

      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.

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

              Created:
              Updated:
              Resolved: