Skip to content

136: make custom method paths follow a sub-resource like structure #302

@toumorokoshi

Description

@toumorokoshi

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:

  1. raised by @thegagne: /{id}/actions/undelete - effectively create a specific subresource for custom methods.
  2. {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 actions is 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionchanges that require discussion, and will likely be discussed in the weekly meeting.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions