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

Add term Constraint to Validation vocabulary

    XMLWordPrintable

    Details

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

      Proposed

    • Proposal:
      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>
    • Resolution:
      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

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              handl Ralf Handl
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: