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

Add possibility for enumeration types to "extend" another enumeration type

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: No Action
    • Affects Version/s: V4.0_ERRATA02
    • Fix Version/s: V4.01_WD01
    • Component/s: CSDL XML
    • Labels:
      None
    • Environment:

      Enum Types

    • Proposal:
      Hide

      Introduce "Extends" attribute for enumerations. Enumerations defined with the "Extends" attribute have all of the enumeration values of the extended enumeration, plus the additional enumeration values defined. The extending enumeration must specify member values if, and only if, they are defined in the "original" type.

      Show
      Introduce "Extends" attribute for enumerations. Enumerations defined with the "Extends" attribute have all of the enumeration values of the extended enumeration, plus the additional enumeration values defined. The extending enumeration must specify member values if, and only if, they are defined in the "original" type.

      Description

      [Alternative to ODATA-494]

      We currently don't have a way for adding values to an enumeration type defined by a different schema. This would be helpful for defining custom vocabularies that extend base vocabularies.

      However, defining inheritance for enumerations introduces substitutability that is likely to break clients by returning new enumeration values not anticipated by the client (for instance, in a switch statement).

      An alternative to inheritance would be to introduce the ability for an enumeration type to definitionally extend an existing enumeration type. This is similar to what we do with entity containers, which can extend the definition of an existing container without introducing any substitutability.

      We could even use the same "Extends" attribute, rather than "BaseType" which implies inheritance.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mikep Michael Pizzo
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: