From e04eebddcb8a5254294f08f55617c9270688b1eb Mon Sep 17 00:00:00 2001 From: Patrick Boos Date: Tue, 17 Oct 2023 11:34:47 +0200 Subject: [PATCH] [bugfix] 405 with `operation.notAllowed` should be excluded --- .../core/exclusions/InternalViolationExclusions.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openapi-validation-core/src/main/java/com/getyourguide/openapi/validation/core/exclusions/InternalViolationExclusions.java b/openapi-validation-core/src/main/java/com/getyourguide/openapi/validation/core/exclusions/InternalViolationExclusions.java index 5c5f9ae..a198e95 100644 --- a/openapi-validation-core/src/main/java/com/getyourguide/openapi/validation/core/exclusions/InternalViolationExclusions.java +++ b/openapi-validation-core/src/main/java/com/getyourguide/openapi/validation/core/exclusions/InternalViolationExclusions.java @@ -12,6 +12,7 @@ public class InternalViolationExclusions { public boolean isExcluded(OpenApiViolation violation) { return falsePositive404(violation) || falsePositive400(violation) + || falsePositive405(violation) || customViolationExclusions.isExcluded(violation) || oneOfMatchesMoreThanOneSchema(violation); } @@ -36,4 +37,9 @@ private boolean falsePositive404(OpenApiViolation violation) { private boolean falsePositive400(OpenApiViolation violation) { return violation.getDirection() == Direction.REQUEST && violation.getResponseStatus().orElse(0) == 400; } + + private boolean falsePositive405(OpenApiViolation violation) { + return violation.getResponseStatus().orElse(0) == 405 + && "validation.request.operation.notAllowed".equals(violation.getRule()); + } }