-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: V4.0_OS
-
Fix Version/s: None
-
Component/s: Vocabularies
-
Labels:None
-
Environment:
Proposed
-
Proposal:
-
Resolution:
In some cases EnumType is undesirable because adding a member constitutes a backwards-incompatible change.
If Validation.AllowedValue had an optional Name property (Type="Edm.String" Nullable="true") then Validation.AllowedValues inside a TypeDefinition could be used to define "better enums" (including String-valued enums) that would allow graceful evolution of services without backwards-incompatible changes.
<TypeDefinition Name="Colour" UnderlyingType="Edm.Int32">
<Annotation Term="Validation.AllowedValues">
<Collection>
<Record>
<PropertyValue Property="Name" String="Red"/>
<PropertyValue Property="Value" Int="1"/>
</Record>
<Record>
<PropertyValue Property="Name" String="Blue"/>
<PropertyValue Property="Value" Int="2"/>
</Record>
</Collection>
</Annotation>
</TypeDefinition>
or using String:
<TypeDefinition Name="Colour" UnderlyingType="Edm.String">
<Annotation Term="Validation.AllowedValues">
<Collection>
<Record>
<PropertyValue Property="Name" String="Red"/>
<PropertyValue Property="Value" String="ff0000"/>
</Record>
<Record>
<PropertyValue Property="Name" String="Blue"/>
<PropertyValue Property="Value" String="0000ff"/>
</Record>
</Collection>
</Annotation>
</TypeDefinition>
TBD (possibly should be spun off to another JIRA issue): how to mark an AllowedValues to indicate that it provides the equivalent of a Flags-style EnumType.