OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] (ODATA-494) Define inheritance for enumeration types


     [ https://issues.oasis-open.org/browse/ODATA-494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Pizzo updated ODATA-494:
--------------------------------

        Summary: Define inheritance for enumeration types  (was: Add possibility for enumeration types to "extend" other enumerations)
       Assignee: Ralf Handl  (was: Michael Pizzo)
       Reporter: Ralf Handl  (was: Michael Pizzo)
    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. 

  was:
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. 

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.

       Proposal: 
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"  


  was: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 extended type.


Accidentally edited existing issue rather than opening a new issue with an alternate proposal. Opened new issue OData-849, and setting this issue back to the original proposal.

> Define inheritance for enumeration types
> ----------------------------------------
>
>                 Key: ODATA-494
>                 URL: https://issues.oasis-open.org/browse/ODATA-494
>             Project: OASIS Open Data Protocol (OData) TC
>          Issue Type: Improvement
>          Components: OData CSDL
>    Affects Versions: V4.0_CS01
>            Reporter: Ralf Handl
>            Assignee: Ralf Handl
>              Labels: GoodIdea
>             Fix For: V4.01_WD01
>
>
> 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. 



--
This message was sent by Atlassian JIRA
(v6.2.2#6258)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]