Enhance Validation.AllowedValue to have optional symbolic name

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • None
    • Affects Version/s: V4.0_OS
    • Component/s: Vocabularies
    • None
    • Environment:

      Proposed

    • Hide

      Define a new SymbolicName annotation that can be applied to the AllowedValues annotation (or other places) of type SimpleIdentifier (a new TypeDef with underlying type of string).

      Add SymblicName to the list of ApplicableTerms for AllowedValues.

      Show
      Define a new SymbolicName annotation that can be applied to the AllowedValues annotation (or other places) of type SimpleIdentifier (a new TypeDef with underlying type of string). Add SymblicName to the list of ApplicableTerms for AllowedValues.
    • Show
      https://github.com/oasis-tcs/odata-vocabularies/pull/73  

      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.

            Assignee:
            Unassigned
            Reporter:
            evan.ireland.2
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: