OpenAPI-Specification icon indicating copy to clipboard operation
OpenAPI-Specification copied to clipboard

More example `same hierarchy` in path templating

Open ota42y opened this issue 6 years ago • 1 comments

We can't describe different templated name with same hierarchy.

Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical.

But I can't understand what the same hierarchy means.

We can't describe these path templates

  /pets/{petId}
  /pets/{name}

But we can describe these?

  /pets/{petId}
  /pets/{name}/hello

These depth of the hierarchy is different but these is different templated name in same depth of hierarchy. When we get /pets/1/hello we can match bottom paths and name=1. These is partially the same, but the whole is different.

So I want to add more example to this section.

ota42y avatar Sep 25 '19 00:09 ota42y

I agree. There are some edge cases that should be clarified.

This example is clear:

/pets/{petId}
/pets/{name}

But what it there are different HTTP methods, like:

GET /pets/{petId}
DELETE /pets/{name}

And example provided by @ota42y

/pets/{petId}
/pets/{name}/hello

It looks like they are obviously different but because of different parameter name on the same level it's questionable if it should be allowed, or rather

/pets/{petId}
/pets/{petId}/hello

This is important from parsers implementation point of view

kapone89 avatar Sep 30 '19 08:09 kapone89