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

Apply, as much as possible, our JSON Format to our annotations as well

    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

      Use same representation for constant expressions as for primitive values in JSON format, i.e. no object wrapper such as

      "@some.binary.term":{"$Binary":"..." }
      

      Instead use the plain value: 

      "@some.binary.term":"..."
      

      This puts some burden on clients to "know" or look up the term definition to determine the actual type of a JSON string value, but that has to be done for JSON data responses anyway.

      Note that no way to distinguish between strings and data exception, datetime, guid values in a collection of Edm.PrimitiveType. In such a case, generic libraries should treat as string and clients must use out of band knowledge to interpret it as some other value.

      Same argument applies to model element path expressions: here the client knows from the term definition that the value is a model element path or one of its concreter sub-types, so the value can simply be a string containing the path without object wrapper:

      "NonExpandableProperties":["Customer","Country"]
      

      Instance path expressions still need the object wrapper to distinguish them from actual string values:

      "@Core.Description":{"$Path","CompanyName"}
      

       

      Show
      Use same representation for constant expressions as for primitive values in JSON format, i.e. no object wrapper such as "@some.binary.term" :{ "$Binary" : "..." } Instead use the plain value:  "@some.binary.term" : "..." This puts some burden on clients to "know" or look up the term definition to determine the actual type of a JSON string value, but that has to be done for JSON data responses anyway. Note that no way to distinguish between strings and data exception, datetime, guid values in a collection of Edm.PrimitiveType. In such a case, generic libraries should treat as string and clients must use out of band knowledge to interpret it as some other value. Same argument applies to model element path expressions: here the client knows from the term definition that the value is a model element path or one of its concreter sub-types, so the value can simply be a string containing the path without object wrapper: "NonExpandableProperties" :[ "Customer" , "Country" ] Instance path expressions still need the object wrapper to distinguish them from actual string values: "@Core.Description" :{ "$Path" , "CompanyName" }  
    • Resolution:
      Show
      https://github.com/oasis-tcs/odata-csdl-schemas/commit/4591a198452cdd2bb647aa3a1c15f577383ac622 https://www.oasis-open.org/committees/download.php/64129/odata-csdl-json-v4.01-wd05-2018-10-22.docx  

      Description

      In ODATA-1170 we added the ability to add the type to a term of an enum type.

      The solution chosen was to annotate the predefined, one and only, $EnumMember property, which, by itself, does not add anything other then telling the consumer that he/she is dealing with the name of a member of an enum type, still requiring the $metadata document to find out what the actual enum type is.

      That raises the question why one needs that object wrapper to begin with and why we, like with regular enum typed structured properties, don't simply use the same format and return the enum members name as a string value of that term. 

      And if we do so for enum types why wouldn't we do that for all primitive types for which we introduced a similar wrapper object with one predefined $-property?

       

      Side question: Does our XML to JSON CSDL conversion correctly convert our annotations to begin with? I'd be tempted to say that enum properties IN complex types used in terms should use the standard JSON format and not the object wrapper with the $EnumMember property either not?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hubert.heijkers Hubert Heijkers (Inactive)
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: