All API paths in a Swagger specification should be unique.
Uniqueness is not only based on verbatim equality, but also functional equivalency.
This rule aims to ensure that API paths are literally and functionally unique.
{
"paths": {
"/pets/{id}": ...,
"/pets/{id}": ...,
"/pets/{chipId}": ...,
"/pets/{petId}": ...,
"/pets/{uuid}": ...
}
}
{
"paths": {
"/pets/{petId}": ...
}
}
In cases where your API path has a param that needs functional distinction, add a query
input qualifier, e.g.,
GET /pets/{id}?idType=aaha
GET /pets/{id}?idType=petlink
For identifiers, create a UUID and create a model called RegisteredId
that provides identifier semantics (if possible):
GET /pets/{uuid}/registeredIds
Returns:
[
{
"id": "11111111",
"type": "aaha",
"registrationAuthority": "American Animal Hospital Association",
"validFrom": 1326261600000,
"validTo": null
},
{
"id": "22222222",
"type": "petlink",
"registrationAuthority": "Datamars",
"validFrom": 1326261600000,
"validTo": null
}
]
The no-dup-paths
rule was introduced to eslint-plugin-swagger
in version 0.1.0
.