Open asos-danielc opened 11 months ago
I encountered the same issue. I can't validate against more than one specification.
Is this a potential bug, or are we using it incorrectly? I couldn't find any official documentation on using multiple specifications
Perhaps the 'apiSpec' could support an array of specifications, allowing the middleware function to be called just once?
Thanks.
Edit: Tested on v5.1.6
In my case, the problem seems to be when not using servers/url
in the spec.
Using the official example 2-standard-multiple-api-specs as is it works fine.
But if we remove servers
from the specification
servers:
- url: /v2
and modify the path from:
paths:
/pets:
to:
paths:
/v2/pets:
causes 404
{
"message": "not found",
"errors": [
{
"path": "/v2/pets",
"message": "not found"
}
]
}
GET http://localhost:3000/v2/pets?pet_type=kitty
Describe the bug A clear and concise description of what the bug is.
/hello-world/:name
/v2/hello-world/:name/:surname
/v2/hello-world/:name/:surname
is returning 404OpenApiValidator.middleware
has to be called incrementallyTo Reproduce Steps to reproduce the behavior.
./swagger/v1.yaml
./swagger/v2.yaml
useRoutes.js
The routes are typical express route definitions:
Actual behavior A clear and concise description of what happens.
GET http://localhost:3000/hello-world/Dan ā works as it did before
GET http://localhost:3000/v2/hello-world/Dan ā 404 response
If I don't register the unversioned route (
/hello-world/:name
), then the v2 route (/v2/hello-world/:name/:surname
) does work.Expected behavior A clear and concise description of what you expected to happen.
I am expecting the unversioned route and the versioned route to both work
Examples and context An example or relevant context e.g. an OpenAPI snippet, an Express handler function snippet