Add term Constraint to Validation vocabulary

    • Type: New Feature
    • Resolution: Fixed
    • Priority: Major
    • V4.0_CSD02
    • Affects Version/s: V4.0_CSD01
    • Component/s: Vocabularies
    • None
    • Environment:

      Proposed

    • Hide

      Add new term

      <Term Name="Constraint"
      Type="Validation.ConstraintType"
      AppliesTo="Property EntityType ComplexType">
      <Annotation Term="Core.Description" String="Condition that the annotation target has to fulfill" />
      </Term>
      <ComplexType Name="ConstraintType">
      <Property Name="FailureMessage" Type="Edm.String" Nullable="true">
      <Annotation Term="Core.IsLanguageDependent" />
      </Property>
      <Property Name="Condition" Type="Edm.Boolean" Nullable="false">
      <Annotation Term="Core.Description"
      String="Value MUST be a dynamic expression that evaluates to true if and only if the constraint is fulfilled" />
      </Property>
      </ComplexType>

      Example:

      <Annotation Term="Validation.Constraint" Qualifier="Comparison">
      <Record>
      <PropertyValue Property="FailureMessage" String="Start date cannot be after end date" />
      <PropertyValue Property="Condition">
      <Le>
      <Path>StartDate</Path>
      <Path>EndDate</Path>
      </Le>
      </PropertyValue>
      </Record>
      </Annotation>

      Show
      Add new term <Term Name="Constraint" Type="Validation.ConstraintType" AppliesTo="Property EntityType ComplexType"> <Annotation Term="Core.Description" String="Condition that the annotation target has to fulfill" /> </Term> <ComplexType Name="ConstraintType"> <Property Name="FailureMessage" Type="Edm.String" Nullable="true"> <Annotation Term="Core.IsLanguageDependent" /> </Property> <Property Name="Condition" Type="Edm.Boolean" Nullable="false"> <Annotation Term="Core.Description" String="Value MUST be a dynamic expression that evaluates to true if and only if the constraint is fulfilled" /> </Property> </ComplexType> Example: <Annotation Term="Validation.Constraint" Qualifier="Comparison"> <Record> <PropertyValue Property="FailureMessage" String="Start date cannot be after end date" /> <PropertyValue Property="Condition"> <Le> <Path>StartDate</Path> <Path>EndDate</Path> </Le> </PropertyValue> </Record> </Annotation>
    • Show
      https://github.com/oasis-tcs/odata-vocabularies/commit/ef593debef903e0f0b792c72976d517505b9cd61 Approved: https://www.oasis-open.org/apps/org/workgroup/odata/download.php/61713/latest/odata-meeting-190_on-20171005-minutes.html

      Communicating validation rules to the clients helps reduce the number of failed requests in API as well as UI scenarios.

      Besides the elementary rules Minimum, Maximum, Pattern, ... it would be helpful to allow expressing more complicated validation rules that involve logical and arithmetic expressions.

            Assignee:
            Unassigned
            Reporter:
            handl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: