-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routes with glob caused error starting from 5.3.7 #1019
Comments
This issue arises from a change in path-to-regex. You can find more details in the README under the Express 4.x section, specifically bullet point 3, which directly affects your case. However, you can address your scenario using the alternative approach mentioned in bullet point 1. @imsamurai can you describe what you are trying to match with the glob? is it arbitrary paths? some examples will be helpful |
note that there are mechanism to match wild card paths. see this test and accompanying spec another example... you can match paths using the following: {
// ...
paths: {
'/some/{wildcard}*': {
parameters: [
{
name: 'wildcard',
in: 'path',
required: true,
schema: {
type: 'string',
},
},
],
get: {
responses: {
'200': {
description: 'OK',
},
},
},
},
}
// ...
} .get('/api/some/:wildcard(*)', (req, res) => {
const wildcard = req.params.wildcard;
console.log(`Wildcard: ${wildcard}`);
res.status(200).send(`Matched wildcard: ${wildcard}`);
}), then |
im closing this out given there are options to handle your case. please re-open if i've not captured your scenario properly additionally, the openapi spec doesn't support wildcard paths, see here. that said, such paths are common practice when developing rest apis. as a result, express-openapi-validator intends to support them |
Sorry for delay, you ask about use case. Maybe you can do some backward compatibility in validator? Because this is major change, not path version. |
Describe the bug
Route like
/some/(.*)
causedstarting from version 5.3.7
To Reproduce
add route to spec and go /some
Actual behavior
Error
Expected behavior
Validation success
The text was updated successfully, but these errors were encountered: