-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Bugfix] Exclude violation operation.notAllowed
with 405
#43
Conversation
|
||
private boolean falsePositive405(OpenApiViolation violation) { | ||
return violation.getResponseStatus().orElse(0) == 405 | ||
&& "validation.request.operation.notAllowed".equals(violation.getRule()); |
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.
Should the rule name here go into a constant? Are all rules defined somewhere?
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.
They are not defined anywhere in swagger-request-validator
. I have now extracted them here in the file at least.
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.
Will create a const file now as we also use them in other places.
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.
Change looks good, just a formality. Also, there are tons of changes that seem unrelated to the fix - I didn't check those in detail. Would recommend not including these in the future, or creating a separate PR.
When there is a
validation.request.operation.notAllowed
violation and the response already is405
(Method Not Allowed) then this should not be reported as a violation.Reason: The API responds correctly that this method is not allowed. There is nothing to be fixed in the API nor the spec.