-
Notifications
You must be signed in to change notification settings - Fork 23
Description
The original motivation for this discussion starts with https://cloud-native.slack.com/archives/C04TX46UCTV/p1751055711107579. Inlined:
Running into a problem with soft delete w/ AWS API Gateway.
Unable to create resource at path '/instances/{instance_id}/encryption-keys/key-encryption-keys/{id}:undelete': Resource's path part only allow a-zA-Z0-9._-: or a valid greedy path variable and curly braces at the beginning and the end.
I think it expects "greedy path variables" like {id}in that example to not share a path with the :undelete part. Suggestions?
It's probably not worth modifying the API guidance on behalf of one specific API gateway implementation. However, the existing structure does include inconsistencies that I think are problematic from a design standpoint, as well: {id}:customMethodName looks kind of like a resource, so pattern matching frameworks which work off of path match delimiters may not be able to properly parse the custom method out (without custom logic).
Some alternatives:
- raised by @thegagne:
/{id}/actions/undelete- effectively create a specific subresource for custom methods. {id}/:undelete- a subcollection that is prefixed with a colon is a custom method.
I think (1) comes with a couple disadvantages:
- the slight disadvantage that "actions" is a now a reserved namespace.
- the fact that it looks like
actionsis a subresource, and there will be additional complexity in clients to support this specific pattern.
(2) does not come with the the first disadvantage. There will be some custom handling needed for 2, but this is no more complex than existing clients which have to parse out the custom method.
Either way, I think it would be best to adjust this pattern to help support less flexible path parses and gateways.