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

Define inheritance for enumeration types

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: No Action
    • Affects Version/s: V4.0_CS01
    • Fix Version/s: V4.01_WD01
    • Component/s: CSDL XML
    • Labels:
    • Environment:

      Enum Types, Closed without Action

    • Proposal:
      Hide

      Proposed
      Proposal Allow EnumType to specify a BaseType to which the EnumType will add new members. BaseType and UnderlyingType cannot be both specified, the UnderlyingType.

      In metadata annotations the EnumMember syntax requires prefixing the member name with the fully qualified type name in all cases, so there's no ambiguity if the same base enum type is extended by more than one other enum type.

      For properties and instance annotations in request and response bodies enum members are represented only as the member name without the type name prefix if the member is defined by the declared type of the property. Members of a derived type must be prefixed with the qualified type name. This is consistent with the metadata annotation syntax and the URL syntax for accessing properties of derived types:

      "PrimaryColor":"Yellow"
      "SecondaryColor":"org.example.ExtendedPattern/DarkRed"

      Show
      Proposed Proposal Allow EnumType to specify a BaseType to which the EnumType will add new members. BaseType and UnderlyingType cannot be both specified, the UnderlyingType. In metadata annotations the EnumMember syntax requires prefixing the member name with the fully qualified type name in all cases, so there's no ambiguity if the same base enum type is extended by more than one other enum type. For properties and instance annotations in request and response bodies enum members are represented only as the member name without the type name prefix if the member is defined by the declared type of the property. Members of a derived type must be prefixed with the qualified type name. This is consistent with the metadata annotation syntax and the URL syntax for accessing properties of derived types: "PrimaryColor":"Yellow" "SecondaryColor":"org.example.ExtendedPattern/DarkRed"

      Description

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

      It's sort of inheritance for enumerations, given the fact that some programming languages implement enumerations as classes/objects with members/properties for the enumeration values.

      So we could add an attribute "BaseType" or "Extends" for EnumType to add new enumeration values.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: