MarketSquare / MarketSquare/robotframework-openapitools

Inconsistent url picking in case of "nested" id

Open
#134 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
28
Forks
7
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the described sequence with the sanitized OAS when it is available, comparing the v2 behavior with v1. Trace how path_relation selects the parent URL for nested address creation and how the resulting IDs are reused for the nested endpoint. Done means addresses created for id1 are later accessed under id1, without breaking the configured my_id path.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.