-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Added better support for testing with AJV having discriminat…
…or option turned on (#4257) * feature: Added better support for testing with AJV having discriminator option turned on A recent issue made it clear that we didn't make it easy for users to turn on `discriminator` support from AJV - In `@rjsf/utils` improved support for `discriminator` as follows: - Updated the `ValidatorType` to add support for an optional `reset()` method - Updated the `ParserValidator` to implement `reset()` to clear the schema map, including a test to verify that - Updated the tests that used `discriminator` to remove the `mapping` block that AJV doesn't support - Updated the `getFirstMatchingOption()` test to deal with the situation where AJV doesn't support discriminator for array types - Updated the `retrieveSchema()` test to call `reset()` on validators that have it in an `afterEach()` - Updated the `getTestValidator()` implementation to implement a `reset()` that empties the arrays - In `@rjsf/validator-ajv8` improved support for `discriminator` as follows: - Updated the `createAjvInstance()` function to denote that we want to make `discriminator: true` the default in v6 - Updated the `AJV8Validator` to make reset do `ajv.removeSchema()` to clear the cached schemas - Updated the `getTestValidator() implementation to call `reset()` on the validator if it exists - Updated the `schema.test.ts` file to run a set of test with `discriminator: true` set on the `AJV8Validator` - Updated the `CHANGELOG.md` file accordingly * - Added required for `code` to all of the schemas * - Switched the default Translatable strings to use Markdown
- Loading branch information
1 parent
7f54d45
commit a2dc1cd
Showing
14 changed files
with
99 additions
and
25 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
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
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
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
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
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
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
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
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
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
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
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
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
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