Skip to content

Commit 48cf56e

Browse files
authored
Merge branch 'main' into fix/sample-rate-selection
2 parents 9f52f9c + 8077cab commit 48cf56e

10 files changed

Lines changed: 51 additions & 28 deletions

File tree

‎CODEOWNERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @getyourguide/uspr
1+
* @getyourguide/payx

‎gradle/libs.versions.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
java = "21"
33
spring-boot = "4.0.7"
44
spring-dependency-management = "1.1.7"
5-
openapi-generator = "7.21.0"
5+
openapi-generator = "7.22.0"
66
openapi-tools = "0.2.9"
7-
swagger = "2.2.46"
7+
swagger = "2.2.49"
88
swagger-request-validator = "2.46.1"
99
jakarta-validation = "3.1.1"
1010
lombok = "1.18.44"

‎gradle/wrapper/gradle-wrapper.jar‎

-504 Bytes
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
44
networkTimeout=10000
5+
retries=0
6+
retryBackOffMs=500
57
zipStoreBase=GRADLE_USER_HOME
68
zipStorePath=wrapper/dists

‎gradlew‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎gradlew.bat‎

Lines changed: 10 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎openapi-validation-api/src/main/java/com/getyourguide/openapi/validation/api/Rules.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public static class Request {
55
public static final String PATH_MISSING = "validation.request.path.missing";
66
public static final String OPERATION_NOT_ALLOWED = "validation.request.operation.notAllowed";
77
public static final String BODY_SCHEMA_ONE_OF = "validation.request.body.schema.oneOf";
8+
public static final String ACCEPT_NOT_ALLOWED = "validation.request.accept.notAllowed";
89
}
910

1011
public static class Response {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public class InternalViolationExclusions {
1212
private final ViolationExclusions customViolationExclusions;
1313

1414
public boolean isExcluded(OpenApiViolation violation) {
15-
return falsePositive404(violation)
15+
return falsePositive204(violation)
16+
|| falsePositive404(violation)
1617
|| falsePositive405(violation)
1718
|| falsePositive406(violation)
1819
|| falsePositiveRequestWith4xxResponse(violation)
@@ -31,6 +32,11 @@ private static boolean oneOfMatchesMoreThanOneSchema(OpenApiViolation violation)
3132
.matches(".*Instance failed to match exactly one schema \\(matched [1-9][0-9]* out of \\d+\\).*");
3233
}
3334

35+
private boolean falsePositive204(OpenApiViolation violation) {
36+
return violation.getResponseStatus().orElse(0) == 204
37+
&& Rules.Request.ACCEPT_NOT_ALLOWED.equals(violation.getRule());
38+
}
39+
3440
private boolean falsePositive404(OpenApiViolation violation) {
3541
return
3642
(

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public void whenViolationThenViolationNotExcluded() {
2929
checkViolationNotExcluded(buildSimpleViolation(Direction.RESPONSE, 404));
3030
checkViolationNotExcluded(buildSimpleViolation(Direction.RESPONSE, 400));
3131
checkViolationNotExcluded(buildSimpleViolation(Direction.REQUEST, 200));
32+
checkViolationNotExcluded(buildSimpleViolation(Direction.REQUEST, 204));
3233
checkViolationNotExcluded(buildSimpleViolation(Direction.REQUEST, null));
3334
checkViolationNotExcluded(buildSimpleViolation(Direction.RESPONSE, 200));
3435
}
@@ -159,6 +160,30 @@ public void when406ResponseCodeWithStatusUnknownViolationThenViolationExcluded()
159160
.build());
160161
}
161162

163+
@Test
164+
public void when204ResponseCodeWithAcceptNotAllowedViolationThenViolationExcluded() {
165+
when(customViolationExclusions.isExcluded(any())).thenReturn(false);
166+
167+
checkViolationExcluded(buildAcceptNotAllowedViolation(204));
168+
}
169+
170+
@Test
171+
public void whenNon204ResponseCodeWithAcceptNotAllowedViolationThenViolationNotExcluded() {
172+
when(customViolationExclusions.isExcluded(any())).thenReturn(false);
173+
174+
checkViolationNotExcluded(buildAcceptNotAllowedViolation(200));
175+
}
176+
177+
private static OpenApiViolation buildAcceptNotAllowedViolation(int responseStatus) {
178+
return OpenApiViolation.builder()
179+
.direction(Direction.REQUEST)
180+
.rule("validation.request.accept.notAllowed")
181+
.responseStatus(responseStatus)
182+
.message("Request Accept header '[application/json]' does not match any defined response types. "
183+
+ "Must be one of: [application/problem+json].")
184+
.build();
185+
}
186+
162187
@Test
163188
public void whenUnknownErrorWithConcurrentModificationExceptionThenViolationExcluded() {
164189
when(customViolationExclusions.isExcluded(any())).thenReturn(false);

‎service-provisioning.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
service:
22
name: openapi-validation-java
3-
owner: uspr
3+
owner: payx
44
type: Library
55
level: best effort
66
main_language: Java

0 commit comments

Comments
 (0)