Open kokovtsev opened 6 months ago
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).
fixes #179