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

feat!: oneOf now has more strict validation, it actually checks that exactly one schema matches #181

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kokovtsev
Copy link
Contributor

@kokovtsev kokovtsev commented Jan 10, 2024

fixes #179

Copy link
Contributor

reviewpad bot commented Jan 10, 2024

AI-Generated Summary: This pull request introduces a more rigorous validation for the oneOf schema; it now verifies that exactly one schema matches when processing the inputs. The current state of the oneOf schema behaves more like an anyOf schema where it checks if the input matches any of the schemas, rather the being strictly 'one' schema as the name implies.

This patch implements this change by introducing a new AnyOfSchemaObjectCodec and its associated types and modifications in the related files. It also updates various test files, and introduces new utility functions related to handling Union Types, and a bundle for handling validations based on various schemas in utils.bundle.ts.

Two new tests have been added to the utils.bundle.spec.ts file for comprehensive testing of the modified behavior. Similarly, code in schema-object.spec.ts has been updated to reflect these changes in how the oneOf schemas are handled.

In summary, the changes made improve the overall accuracy of the schema validation, ensuring that it meets the expectations reflected in its naming (i.e., oneOf should only match exactly one schema).

@reviewpad reviewpad bot added the large Pull request is large label Jan 10, 2024
@kokovtsev kokovtsev mentioned this pull request Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
large Pull request is large
Projects
None yet
Development

Successfully merging this pull request may close these issues.

anyOf support
1 participant