Skip to content
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 "matched 2 out of 25" in the oneOf rule #36

Merged
merged 4 commits into from
Aug 30, 2023

Conversation

pboos
Copy link
Contributor

@pboos pboos commented Aug 30, 2023

A violation like the following should have been excluded, but was not:

OpenAPI spec validation error [validation.response.body.schema.oneOf]
...

INFO - [Path '/.../0'] Instance failed to match exactly one schema (matched 2 out of 25): 
...

Bug: It only worked if matched 2 out of x with x being a single number.

This is fixed with this PR switching from just \d to \d+.

@pboos pboos requested review from a team and dominik-riha August 30, 2023 09:29
Comment on lines +20 to +25
return (
"validation.response.body.schema.oneOf".equals(violation.getRule())
|| "validation.request.body.schema.oneOf".equals(violation.getRule())
)
&& violation.getMessage()
.matches(".*Instance failed to match exactly one schema \\(matched [1-9][0-9]* out of \\d+\\).*");
Copy link
Contributor Author

@pboos pboos Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ I decided to also add the rules, to be safe.

Copy link

@eleonoraborghi eleonoraborghi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏅

@pboos pboos merged commit ff2e60a into main Aug 30, 2023
@pboos pboos deleted the bugfix/oneOf-exclusion-not-working-with-of-xx branch August 30, 2023 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants