-
Notifications
You must be signed in to change notification settings - Fork 227
Strict request matching for validation. #222
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
Conversation
lib/options.js
Outdated
| id: 'strictRequestMatching', | ||
| type: 'boolean', | ||
| default: false, | ||
| description: 'Whether schema operations be strictly matched with collection request or not.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the or not is redundant
Also, the requests are matched with operations, not the other way round
Whether requests should be strictly matched with schema operations. Setting to true will not include any matches where the URL path segments don't match exactly.
lib/schemaUtils.js
Outdated
| matchScore: schemaMatchResult.score, | ||
| pathVars: schemaMatchResult.pathVars | ||
| pathVars: schemaMatchResult.pathVars, | ||
| fixMatchedSegments: schemaMatchResult.fixMatchedSegments, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe what these two are
| fixMatchedSegments++; | ||
| } | ||
|
|
||
| // for variable match increase variable matched segments count (used for determining order for multiple matches) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for /a/b/{{c}} and /a/b/{{c}}, is the fixMatchedSegments value supposed to be 2 or 3? If 2, the check should be moved after the variables check, right?
also, rename to fixedMatchedSegments everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it would be 3 here, Moving fixMatchedSegments check after and in else if statements to variableMatchedSegments segment. so only one of them is valid per segment.
…estMatching and updated variable matching to be priorotized over fixed matching
Added support for missing endpoints in collection.
This PR introduces option
strictRequestMatchingused for improved validation.