Equivalent paths are not allowed even thogh the path + verb combination is different
See original GitHub issuePaste this spec in https://editor.swagger.io:
info:
title: Server
version: 1.0.0
host: 'localhost:8000'
basePath: /
produces:
- application/json
schemes:
- http
swagger: '2.0'
paths:
'/path/{paramName}':
get:
summary: Get paramName
parameters:
- name: paramName
in: path
required: true
type: string
responses:
'200':
description: Success
'/path/{someOtherParamNameButTheVerbIsPut}':
put:
summary: Update paramName
parameters:
- name: someOtherParamNameButTheVerbIsPut
in: path
required: true
type: string
responses:
'200':
description: Success
Though path+verb combinations are different, it throws error. This is not expected at all!
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Swagger: "equivalent path already exists" despite different ...
That's because the two paths can be identical. I understand that the parameters may uniquely identify them, but OpenAPI 2.0 (Swagger 2.0), ...
Read more >Paths and Operations - Swagger
OpenAPI defines a unique operation as a combination of a path and an HTTP method. This means that two GET or two POST...
Read more >Fix your Swagger Definition! - NotAllAboutCode
Equivalent paths are not allowed.", "Schema error at paths ... should NOT have additional properties", "Schema error at paths ... should be ...
Read more >The Grammar According to West - Math
The mathematics will be easier to read when the formulas are separated by the comma plus words that enable the reader to understand...
Read more >systemd.unit - Freedesktop.org
When the unit is enabled, symlinks will be created for those names, ... was a path (the unescaping results are different for paths...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have this problem as well. Consider this:
I want to add multiple entries all under a specific date:
POST /something/{date}
Each entry gets and ID, which means I can delete or update individual entries like this:
DELETE /something/{id}
PATCH /something/{id}
{id}
needs to be validated as an integer,{date}
as a date string, and I cannot just put them under the same path, because then the variable needs to be named something like{dateOrId}
, which is super ugly and misleading (but works!).Given that the methods don’t overlap because of different verbs, there’s no way this can ever cause a conflict, and it works fine in the real world as well.
Please reconsider this limitation in the future.
TL;DR: This is a limitation of the OpenAPI Specification and not a Swagger Editor issue.
The error means that these paths
are considered identical and therefore invalid. They are identical because there’s no way to tell if
/path/foo
corresponds to/path/{paramName}
or/path/{someOtherParamName}
. The parameter name alone does not make the path unique.What you can do is define a single path
/path/{paramName}
with 2 operationsget
andput
:This limitation has been previously discussed in the OpenAPI Specification repository here: https://github.com/OAI/OpenAPI-Specification/issues/576 https://github.com/OAI/OpenAPI-Specification/issues/788
If you want to change the path matching behavior, file an enhancement request with OpenAPI Specification:
https://github.com/OAI/OpenAPI-Specification/issues