Skip to content

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.

3 participants