apache / apache/openwhisk

Include API GW path parameters as event parameters.

Open
#3,593 6 comments 2 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
6.8k
Forks
1.2k
Avg merge
2d 14h
Merged PRs (30d)
2

Description

This is a feature enhancement for the recently introduced path parameters feature in the API GW: https://github.com/apache/incubator-openwhisk/pull/2966

When actions are invoked with path parameters, the full path is included in the event parameters using the `__ow_path` value. **Individual parameterised path values are not automatically parsed from the request and include as separate event parameters.**

It would be a better developer experience if those path parameters were passed as separate values, saving the developer having to manually re-parse them from the `__ow_path` string.

One option would be to introduce a new variable `__ow_path_params` which contained these values.

AWS Lambda supports this [behaviour](https://stackoverflow.com/questions/31329958/how-to-pass-a-querystring-or-route-parameter-to-aws-lambda-from-amazon-api-gatew).

User migrating from that platform posted the following in Slack.

_I'm migrating from AWS Lambda, and struggling somewhat with passing path parameters into a Python handler from the API gateway. In Lambda, I simply do `pathID = event['pathParameters']['id']` but I can't find any documentation on an easy way to do this in Cloud Functions (noting that the dictionary passed into the handler only seems to contain string parameters). Do I need to use regex on `__ow_path` or am I missing something?_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.