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

Support Functions with /$each and define the representation for collection-valued actions and functions with /$each

    XMLWordPrintable

    Details

    • Proposal:
      Hide

      Support /$each with functions as well as actions.
      The result, in json, of a collection-valued function or action applied to /$each is an array of objects, each minimally containing a property named "value" whose value is the collection of items returned by the action or function.

      $it can be used to reference an item in the outermost collection, which in this case is an instance of an action/function result which may itself be a collection (in which case $it can be followed by /any, /all, or /$count).

      Show
      Support /$each with functions as well as actions. The result, in json, of a collection-valued function or action applied to /$each is an array of objects, each minimally containing a property named "value" whose value is the collection of items returned by the action or function. $it can be used to reference an item in the outermost collection, which in this case is an instance of an action/function result which may itself be a collection (in which case $it can be followed by /any, /all, or /$count).
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/60942/odata-v4.01-wd02-part1-protocol-2017-06-07.docx https://www.oasis-open.org/committees/download.php/60941/odata-v4.01-wd02-part2-url-conventions-2017-06-07.docx https://www.oasis-open.org/committees/download.php/60940/odata-json-format-v4.01-wd02-2017-05-30.docx

      Description

      Since we added the support to use /$each with actions, we have to define what the result looks like. It seems reasonable that the result is an array of action results. What, then, is the shape of the result if the action returns a collection? In order to be annotated with things like count and next link, the result would have to be a collection of value arrays, as in:
      {"value":[{"value":[

      {a=1,b=2}

      ,

      {a=2,b=3}

      ]},{"value":[

      {a=4,b=5}

      ]}]}.

      Once we have defined the result of /$each for actions that return results, it seems natural that we support /$each with functions as well.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: