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

Describe rules for accessing derived entity and complex types in URLs

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_WD01
    • Fix Version/s: V4.0_WD01
    • Component/s: URL Conventions
    • Labels:
      None
    • Environment:

      [Proposed]

    • Proposal:
      Hide

      Any resource path or path expression identifying a collection of entities or complex type instances may be suffixed with "/" and the qualified name of a type derived from the declared type of the collection. The result will be restricted to instances of the derived type and may be empty.

      Any resource path or path expression identifying a single entity or complex type instance may be suffixed with "/" and the qualified name of a type derived from the declared type of the identified resource. If used in a resource path and the identified resource is not an instance of the derived type, the request will result in a 404 Not Found error. If used in a path expression that is part of a boolean expression, the boolean expression will evaluate to false.

      Accepted: https://www.oasis-open.org/apps/org/workgroup/odata/download.php/47861/latest/odata-meeting-20_on-20130110-minutes.html

      Show
      Any resource path or path expression identifying a collection of entities or complex type instances may be suffixed with "/" and the qualified name of a type derived from the declared type of the collection. The result will be restricted to instances of the derived type and may be empty. Any resource path or path expression identifying a single entity or complex type instance may be suffixed with "/" and the qualified name of a type derived from the declared type of the identified resource. If used in a resource path and the identified resource is not an instance of the derived type, the request will result in a 404 Not Found error. If used in a path expression that is part of a boolean expression, the boolean expression will evaluate to false. Accepted: https://www.oasis-open.org/apps/org/workgroup/odata/download.php/47861/latest/odata-meeting-20_on-20130110-minutes.html
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/48274/odata-core-v4.0-wd01-part2-url-conventions-2013-02-12-RH.doc Accepted: https://www.oasis-open.org/committees/download.php/48549/odata-meeting-29_on-20130314-minutes.html#odata-140

      Description

      OData allows inheritance for entity types and complex types, and since V3 allows restricting to derived types in URLs, e.g.

      GET ~/Customers/Model.VipCustomer (restrict result to VipCustomer instances)
      GET ~/Customers/Model.VipCustomer(1) (404 if customer 1 is no VipCustomer)
      GET ~/Customers(1)/Model.VipCustomer (same as above)

      GET ~/Customers(1)/Address/Model.AddressWithLotsOfDetails/SomeDetailNotInPlainAddress/$value (cast complex property to subtype, then follow path)

      The current ABNF rules allow the above resource paths, plus "casting" to derived types in system query options (curiously enough only for entity types, but not for complex types):

      GET ~/Customers?$filter=Model.VipCustomer/PercentageOfVipPromotionProductsOrdered gt 80 (false for all non-VipCustomers)

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: