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

Simplify rule for implicit values of enumeration members

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_CSD01
    • Fix Version/s: V4.0_CSD02
    • Component/s: CSDL XML
    • Labels:
      None
    • Environment:

      [Applied]

      Description

      Enumeration members have an optional Value attribute for specifying an integer equivalent to the symbolic member name that is for ordering.

      The current rule for implicitly numbering the enumeration members is cloned from the C family of programming languages and allows specifying values for some members while having the other members being numbered implicitly. This can lead to surprising results for the uninitiated:

      <EnumType Name="ShippingMethod">
      <Member Name="VIP"/>
      <Member Name="FirstClass"/>
      <Member Name="TwoDay" Value="0"/>
      <Member Name="Overnight"/>
      </EnumType>

      The result is that both VIP and TwoDay get the value zero and both FirstClass and Overnight get the value 1.

      While we see value in having Value optional, we see no value in providing a value for some members only.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: