Clarify that numeric enum values are serialized as strings

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • V4.0_ERRATA03
    • Affects Version/s: V4.0_ERRATA02
    • Component/s: JSON Format
    • None
    • Environment:

      [Applied]

    • Hide

      Add example for numeric value to section 7.1

      Rephrase sentence to

      Enumeration values are represented as JSON strings whose content satisfies the rule
      enumValue in [OData-ABNF].
      The preferred representation is the enumerationMember. If no enumerationMember (or
      combination of enumerationMembers) is available, the enumMemberValue may used.

      Strengthen wording throughout that the numeric value should only be used if there is no string equivalent, both in payloads and in urls.

      Applied:
      https://www.oasis-open.org/committees/download.php/55612/odata-json-format-v4.0-wd08-2015-05-07.docx

      Show
      Add example for numeric value to section 7.1 Rephrase sentence to Enumeration values are represented as JSON strings whose content satisfies the rule enumValue in [OData-ABNF] . The preferred representation is the enumerationMember. If no enumerationMember (or combination of enumerationMembers) is available, the enumMemberValue may used. Strengthen wording throughout that the numeric value should only be used if there is no string equivalent, both in payloads and in urls. Applied: https://www.oasis-open.org/committees/download.php/55612/odata-json-format-v4.0-wd08-2015-05-07.docx

      Section 7.1 states that

      Values of type enumValue are represented as JSON strings using the
      enumerationMember, defined in [OData-ABNF], where available.

      Unfortunately it does not state explicitly how the numeric alternative values for enumeration members are to be serialized.

      The original intent stated in https://issues.oasis-open.org/browse/ODATA-96 and the referenced revised proposal https://www.oasis-open.org/apps/org/workgroup/odata/download.php/47997/Supporting%20Enumeration%20Types%20in%20OData.docx was to

      support the alternate representation of an enumeration value as the
      underlying integer value as a string.

      with an explicit example for JSON

      "color":"32"

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

              Created:
              Updated:
              Resolved: