OpenAPI duplicate paths

1.9k views Asked by At

There are two paths in an OAS 3.0 specification. Technically both seem to be identical, I need to confirm if indeed both are identical. If yes, why none of the tools out there validates these types of paths duplication.

/foo/{whatever}

and

/{whatever}/foo
1

There are 1 answers

0
Helen On BEST ANSWER

OpenAPI Specification only has this to say:
https://spec.openapis.org/oas/v3.0.1.html#path-templating-matching

The following may lead to ambiguous resolution:

/{entity}/me
/books/{id}

That is, these paths are not considered identical, but can result in ambiguous path matching in tooling, especially if both paths support the same HTTP methods. However, if the ambiguous paths support different HTTP methods (e.g. one is GET-only, whereas the other one is POST-only), this would eliminate the ambiguity.