Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expressions in action payloads #341

Closed
ralfhandl opened this issue Mar 20, 2024 · 2 comments · Fixed by #1943 or #1950
Closed

Expressions in action payloads #341

ralfhandl opened this issue Mar 20, 2024 · 2 comments · Fixed by #1943 or #1950
Assignees
Labels

Comments

@ralfhandl
Copy link
Contributor

ralfhandl commented Mar 20, 2024

Use case

The history of department D15 (example data from [OData-Temporal]) shall be merged into D08. Assume we already have a function toTimeslices that converts Departments('D15')/history into the TimesliceWithPeriod format so that

GET ~/Departments('D15')/history/Temporal.toTimeslices()

returns

[{"Timeslice": {
   "From": "2010-01-01",
   "To": "2011-01-01",
   "Name": "Services",
   "Budget": 1100
}},
 {"Timeslice": {
   "From": "2011-01-01",
   "To": "9999-12-31",
   "Name": "Services",
   "Budget": 1700
}}]

If action parameters were specified in the URL, one could write:

POST ~/Departments('D08')/history/Temporal.Update(deltaTimeslices=@delta)
&@delta=$root/Departments('D15')/history/Temporal.toTimeslices()

But action parameters must be passed in the payload, and this does not allow aliases and expressions.

Suggestion

POST ~/Departments('D08')/history/Temporal.Update

{
 "deltaTimeslices@expressionUrl":
  "$root/Departments('D15')/history/Temporal.toTimeslices()"
}

Or, because in a structured payload, a structured expression fits better than an expression string that must be parsed, we borrow notation from CSDL:

POST ~/Departments('D08')/history/Temporal.Update

{
 "deltaTimeslices@expressionCsdl": {
  "$Function": "Temporal.toTimeslices",
  "$Apply": [
   {"$Path": "$root/Departments('D15')/history"}
  ]
 }
}

Imported from ODATA-1505

@HeikoTheissen
Copy link
Contributor

Close only after #1943 is merged.

@HeikoTheissen HeikoTheissen reopened this Jun 20, 2024
@ralfhandl ralfhandl linked a pull request Jun 20, 2024 that will close this issue
@ralfhandl
Copy link
Contributor Author

General agreement for the direction, park it for a few weeks to evaluate syntax alternatives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Closed
2 participants