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

Enhance Validation.AllowedValue to have optional symbolic name

    XMLWordPrintable

    Details

    • 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:
      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.
    • Resolution:
      Show
      https://github.com/oasis-tcs/odata-vocabularies/pull/73  

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              evan.ireland.2 Evan Ireland
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: