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

Allow indexing into collections

    XMLWordPrintable

    Details

    • Proposal:
      Hide

      1) Introduce array collections ODATA-820
      a. Define new term, "Ordered", to advertise that a collection has a stable order. If it is a collection of primitive or complex types it can be indexed by ordinal:
      < Term Name="Ordered" Type="Core.Tag" DefaultValue="true" AppliesTo="Property,NavigationProperty,EntitySet,ReturnType">
      < Annotation Term="Core.Description" String="Collection has a stable order. Ordered collections of primitive or complex types can be indexed by ordinal."/>
      < /Term>
      b. GET/PUT/PATCH/DELETE to the /

      {index}

      of an ordered collection of primitive or complex types retrieves/replaces/modifies/deletes just that item
      i. /index cannot be appended to collections of entities or non-ordered collections
      ii. Index is zero-based ordinal and follows JSONPointer syntax: collection/index
      iii. Clients can specify a negative index to say "from the end" with -1 being the last entry. services must not specify a negative value for an index.
      c. Update section 7.1.5 of the CSDL spec to note that it is possible to have an ordered collection of complex types with navigation properties.

      2) Define a new "PositionalInsert" term to advertise that a collection supports inserting at a given ordinal ODATA-820
      <Term Name="PositionalInsert" Type="Core.Tag" Default="true" AppliesTo="Property, NavigationProperty, EntitySet">
      <Annotation Term="Core.Description" String="Items can be inserted at a given ordinal index."/>
      </Term>
      a. For collections of entity, complex, or primitive types annotated with PositionalInsert, client may specify new ?$index= query parameter in POST request to collection to specify the non-negative, zero-based ordinal position where the item is inserted ODATA-820
      I. Clients can specify a negative index to say "from the end" with -1 being "insert before the last entry".

      Show
      1) Introduce array collections ODATA-820 a. Define new term, "Ordered", to advertise that a collection has a stable order. If it is a collection of primitive or complex types it can be indexed by ordinal: < Term Name="Ordered" Type="Core.Tag" DefaultValue="true" AppliesTo="Property,NavigationProperty,EntitySet,ReturnType"> < Annotation Term="Core.Description" String="Collection has a stable order. Ordered collections of primitive or complex types can be indexed by ordinal."/> < /Term> b. GET/PUT/PATCH/DELETE to the / {index} of an ordered collection of primitive or complex types retrieves/replaces/modifies/deletes just that item i. /index cannot be appended to collections of entities or non-ordered collections ii. Index is zero-based ordinal and follows JSONPointer syntax: collection/index iii. Clients can specify a negative index to say "from the end" with -1 being the last entry. services must not specify a negative value for an index. c. Update section 7.1.5 of the CSDL spec to note that it is possible to have an ordered collection of complex types with navigation properties. 2) Define a new "PositionalInsert" term to advertise that a collection supports inserting at a given ordinal ODATA-820 <Term Name="PositionalInsert" Type="Core.Tag" Default="true" AppliesTo="Property, NavigationProperty, EntitySet"> <Annotation Term="Core.Description" String="Items can be inserted at a given ordinal index."/> </Term> a. For collections of entity, complex, or primitive types annotated with PositionalInsert, client may specify new ?$index= query parameter in POST request to collection to specify the non-negative, zero-based ordinal position where the item is inserted ODATA-820 I. Clients can specify a negative index to say "from the end" with -1 being "insert before the last entry".
    • Resolution:
      Show
      https://www.oasis-open.org/apps/org/workgroup/odata/download.php/59028/odata-v4.01-wd01-part1-protocol.docx https://www.oasis-open.org/apps/org/workgroup/odata/download.php/59029/odata-v4.01-wd01-part2-url-conventions.docx https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/4.01%20spec/ABNF/odata-abnf-construction-rules.txt https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/4.01%20spec/vocabularies/Org.OData.Core.V1.xml

      Description

      Allow indexing into collections.

      If servers can guarantee a stable order, they could advertise this via an annotation.

      This could be combined with ETags to identify the state the client is referring to.

      This might be combined with $orderby to let the client choose the order.

        Attachments

          Activity

            People

            • Assignee:
              mikep Michael Pizzo (Inactive)
              Reporter:
              handl Ralf Handl
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: