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

Dynamic capabilities for containment cases

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.01_OS
    • Fix Version/s: None
    • Component/s: Vocabularies
    • Labels:
      None
    • Environment:

      Proposed

    • Proposal:
      Hide

      Allow annotating capabilities at entity types, so paths can be expressed per the Item instance:

      <Annotations Target="MyService.Item">
        <Annotation Term="Capabilities.UpdateRestrictions">
          <Record Type="Capabilities.UpdateRestrictionsType">
            <PropertyValue Property="Updatable" Path="isUpdatable"/>
          </Record>
        </Annotation>
      </Annotations>
      

      Extend AppliesTo list to include EntityType, and add to description that this "escape hatch" should only be used for dynamic capabilities depending on a property of a related type.

      New proposal after ODATA-1420 has been resolved: See PR #149.

      Show
      Allow annotating capabilities at entity types, so paths can be expressed per the Item instance: <Annotations Target= "MyService.Item" > <Annotation Term= "Capabilities.UpdateRestrictions" > <Record Type= "Capabilities.UpdateRestrictionsType" > <PropertyValue Property= "Updatable" Path= "isUpdatable" /> </Record> </Annotation> </Annotations> Extend AppliesTo list to include EntityType , and add to description that this "escape hatch" should only be used for dynamic capabilities depending on a property of a related type. New proposal after ODATA-1420 has been resolved: See PR #149.
    • Resolution:
      Show
      First resolution: https://github.com/oasis-tcs/odata-vocabularies/pull/98/files Second resolution: https://github.com/oasis-tcs/odata-vocabularies/pull/149

      Description

      Capabilities are annotated on entity sets, and for "nested" / contained entities they are expressed via Capabilities.NavigationRestrictions.

      This works fine for static capabilities (can't ever update, can't ever delete), but does not allow expressing dynamic capabilities via boolean properties on the nested entities.

      Example:

      • Orders have (contained) items
      • Each Item has a property isUpdatable

      The corresponding navigation restriction is (rather bulky):

      <Annotations Target="MyService.EntityContainer/Orders">
        <Annotation Term="Capabilities.NavigationRestrictions">
          <Record Type="Capabilities.NavigationRestrictionsType">
            <PropertyValue Property="RestrictedProperties">
              <Collection>
                <Record Type="Capabilities.NavigationPropertyRestriction">
                  <PropertyValue Property="NavigationProperty" NavigationPropertyPath="items"/>
                  <PropertyValue Property="UpdateRestrictions">
                    <Record Type="Capabilities.UpdateRestrictionsType">
                      <PropertyValue Property="Updatable" Path="isUpdatable"/>
                    </Record>
                  </PropertyValue>
                </Record>
              </Collection>
            </PropertyValue>
          </Record>
        </Annotation>
      </Annotations>
      

      Unfortunately the above annotation is also wrong, because 14.4.1.2 Path Evaluation states

      For annotations embedded within or targeting an entity set or a singleton, the path is evaluated starting at the entity set or singleton, i.e. an empty path resolves to the entity set or singleton, and non-empty paths MUST follow the rules for annotations targeting the declared entity type of the entity set or singleton.

      This means that the annotation would have to use Path="items/isUpdatable" which is a collection of Boolean values and thus not type-compatible with the Updatable property, and the connection to the concrete item that is to be updated is lost.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: