Skip to content

Commit 5d29f2d

Browse files
authored
Merge branch 'main' into dependabot/gradle/commons-codec-commons-codec-1.17.0
2 parents ee4a929 + 371be61 commit 5d29f2d

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ openapi-tools = "0.2.6"
66
swagger = "2.2.20"
77
swagger-request-validator = "2.40.0"
88
jakarta-validation = "3.0.2"
9-
lombok = "1.18.30"
9+
lombok = "1.18.32"
1010
commons-codec = "1.17.0"
1111
find-bugs = "3.0.2"
1212
gradle-nexus-publish-plugin = "1.3.0"

openapi-validation-core/src/main/java/com/getyourguide/openapi/validation/core/exclusions/InternalViolationExclusions.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public class InternalViolationExclusions {
1313

1414
public boolean isExcluded(OpenApiViolation violation) {
1515
return falsePositive404(violation)
16-
|| falsePositive400(violation)
1716
|| falsePositive405(violation)
1817
|| falsePositive406(violation)
18+
|| falsePositiveRequestWith4xxResponse(violation)
1919
|| customViolationExclusions.isExcluded(violation)
2020
|| oneOfMatchesMoreThanOneSchema(violation);
2121
}
@@ -40,8 +40,10 @@ private boolean falsePositive404(OpenApiViolation violation) {
4040
);
4141
}
4242

43-
private boolean falsePositive400(OpenApiViolation violation) {
44-
return violation.getDirection() == Direction.REQUEST && violation.getResponseStatus().orElse(0) == 400;
43+
private boolean falsePositiveRequestWith4xxResponse(OpenApiViolation violation) {
44+
return violation.getDirection() == Direction.REQUEST
45+
&& violation.getResponseStatus().orElse(0) >= 400
46+
&& violation.getResponseStatus().orElse(0) < 500;
4547
}
4648

4749
private boolean falsePositive405(OpenApiViolation violation) {

openapi-validation-core/src/test/java/com/getyourguide/openapi/validation/core/exclusions/InternalViolationExclusionsTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,16 @@ public void whenRequestWithApiPathNotSpecifiedThenViolationExcluded() {
116116
}
117117

118118
@Test
119-
public void whenRequestViolationsAnd400ThenViolationExcluded() {
119+
public void whenRequestViolationsAnd4xxThenViolationExcluded() {
120120
when(customViolationExclusions.isExcluded(any())).thenReturn(false);
121121

122-
checkViolationExcluded(OpenApiViolation.builder()
123-
.direction(Direction.REQUEST)
124-
.responseStatus(400)
125-
.message("")
126-
.build());
122+
for (int responseStatus = 400; responseStatus < 500; responseStatus++) {
123+
checkViolationExcluded(OpenApiViolation.builder()
124+
.direction(Direction.REQUEST)
125+
.responseStatus(responseStatus)
126+
.message("")
127+
.build());
128+
}
127129
}
128130

129131
@Test

0 commit comments

Comments
 (0)