Skip to content

v0.22.1: key and deep-insert fixes

Choose a tag to compare

@jaravan jaravan released this 31 Oct 16:46
· 188 commits to main since this release

What's new

Keys with a slash, a comma or a question mark

A string key holding a character a URL reserves, as SAP document numbers do (SO/2025/1), wasn't found: the path was decoded without decoding the key, so the server looked for the text SO%2F2025%2F1. And the URIs it wrote for such a key didn't encode it, so following them failed:

GET Docs('SO%2F2025%2F1')
  before: 404
  now:    200, the document SO/2025/1

GET Docs('50%25')          (V2)
  before: "__metadata": { "uri": ".../Docs('50%')" }      which leads nowhere
  now:    "__metadata": { "uri": ".../Docs('50%25')" }

Each key value is decoded on its own, so it may hold / , = ? # &, and Location, V2's __metadata.uri and V4's @odata.id encode it.

A deep insert answers with what it created

A create with related entities nested under their navigation created them, but its response left them out, so a client couldn't see their keys or the values the server set. Now the response has them, expanded as deep as the request was, as OData 4.01 asks:

POST PurchaseOrderSet  { "PurchaseOrderId": "1", ..., "Items": [ { "ItemPosition": "0001", ... } ] }
  before: { "PurchaseOrderId": "1", ... }
  now:    { "PurchaseOrderId": "1", ..., "Items": [ { "PurchaseOrderId": "1", "ItemPosition": "0001", ... } ] }

V2 has them as "Items": { "results": [...] }.

A V4 function's parameters are checked

A function called without a parameter that can't be null ran with it as null, and one it doesn't have was ignored. Now both are a 400:

GET GetNearestAirport(lat=1)
  before: 200
  now:    400 RequiredProperty: GetNearestAirport needs its parameter lon

GET GetNearestAirport(lat=1,lon=2,nope=3)
  before: 200
  now:    400 InvalidParameter: GetNearestAirport has no parameter nope

Parameter values in the path are decoded as keys are.

Upgrading

  • A V4 function call that leaves out a parameter with Nullable="false", or names one the function doesn't have, is a 400.
  • A path is decoded once: %25 is %. PurchaseOrderSet%25zz is the set named PurchaseOrderSet%zz, a 404, where it was a 400 for a malformed escape.

Install

npx odata-prova@0.22.1 ./MySrv
docker run -p 3000:3000 -v "$PWD/MySrv:/models/MySrv:ro" ghcr.io/jaravan/odata-prova:0.22.1

Details: Keys in URLs, Deep insert and Actions and functions.