Skip to content

Inconsistent url picking in case of "nested" id #134

@Leemur89

Description

@Leemur89

Hello,

I have a case where my endpoint is like /api/v1/users/{user_id}/address/{address_id}

  1. The system will try to create first a user doing a POST on /api/v1/users. It gets an id id1
  2. Then it tries to do a POST to create an address (to test the PUT/DELETE) on /api/v1/users/{user_id}/address

BUT in my case I also have an endpoint /api/v1/users/{user_id}/address for which I have some specific setup on a specific user with id my_id (which I created before), hence on that one I'm using path_relation to force /api/v1/users/my_id/address

The problem is that on step 2 when the system tries to create an address, it will do it on /api/v1/users/my_id/address (the user preconfigured above) and not on /api/v1/users/id1/address. That will create an address with id idA

And finally, when testing /api/v1/users/{user_id}/address/{address_id}, it will actually call /api/v1/users/id1/address/idA which will fail with 404 because address idA belongs to user my_id and not to user id1

I hope this is clear enough. I'll try to provide sanitized OAS when I have more time.

Note that this happens only since v2.0.0, on v1 I did not have the problem. This is blocking me from upgrading to v2.

I tried to circumvent that issue by using path_relation directly on /api/v1/users/{user_id}/address/{address_id} (on another predetermined user and address), but then the DELETE is called first, making the subsequent GET/PUT fail (since v1 we cannot force the path on a method anymore, it is on the whole endpoint)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions