Axway-API-Management-Plus / odata-routing-policy

A policy which enables the API-Manager to route OData-Requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is the OData routing policy required?

davidgeiger opened this issue · comments

It would be very helpful if the project description provided some insights as to why/when the OData routing policy is required and what exactly it does. We have run tests with many OData APIs - with and without the policy - and could not completely determine in which situations it is required.

One thing we've noticed is that mapping the policy disables query parameter reencoding, which helps with a lot of OData APIs. I am not sure if this is just a side effect. Also, I would be interested if the JVM parameter com.coreapireg.apimethod.querystring.passthrough (introduced in 2020-11) provides an out-of-the-box alternative to achieve this.

Thanks - David

@davidgeiger, from my perspective the script is not required if we use query string defined in swagger spec. The script is required if we are sending query string which is not defined in query string, but we need to send it to backend.

I think we can remove the script after fixing issue #9

System property com.coreapireg.apimethod.querystring.passthrough would be enough to route the request to OData backend if we are not using scripting.

Also, we can remove * at the end of method URL as latest release works without *.

I still believe the * at the end of the exposure path is required. For instance, when using Navigational-Properties like this:

serviceRoot/People('russellwhyte')/Trips(1001)/PlanItems(11)

In that case, our standard API-Path only expects: ('russellwhyte') and method matching will fail because of the remaining part when not having the "*"

The system property is only for the Query-String part. BTW @davidgeiger, we are in discussion with PM to make the toggle: com.coreapireg.apimethod.querystring.passthrough API-Specific instead of global.

I did not check the scenario mentioned by @cwiechmann.

We should have a script to rewrite * and resource path to send an actual URL to backend.

For example, method resource path is defined as /Customers* and testing the API method with URL /Customers('ALFKI')/$links/Orders. By default, when API call reaches API gateway, it matches with resource path /Customers* and calls backend with same resource path /Customers*, with script, the backend is called with /Customers('ALFKI')/$links/Orders.