-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Create class InternalViolationExclusions
- Loading branch information
Showing
3 changed files
with
22 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...java/com/getyourguide/openapi/validation/core/exclusions/InternalViolationExclusions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.getyourguide.openapi.validation.core.exclusions; | ||
|
||
import com.getyourguide.openapi.validation.api.exclusions.ViolationExclusions; | ||
import com.getyourguide.openapi.validation.api.model.OpenApiViolation; | ||
import lombok.AllArgsConstructor; | ||
|
||
@AllArgsConstructor | ||
public class InternalViolationExclusions { | ||
private final ViolationExclusions customViolationExclusions; | ||
|
||
public boolean isExcluded(OpenApiViolation violation) { | ||
return customViolationExclusions.isExcluded(violation) | ||
// If it matches more than 1, then we don't want to log a validation error | ||
|| violation.getMessage().matches( | ||
".*\\[Path '[^']+'] Instance failed to match exactly one schema \\(matched [1-9][0-9]* out of \\d\\).*"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters