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

fix: #3189 by allowing the ajv 8 validator to use alternate schema Ajv classes #3201

Merged
merged 2 commits into from Oct 21, 2022

Conversation

heath-freenome
Copy link
Member

@heath-freenome heath-freenome commented Oct 18, 2022

Reasons for making this change

Fix #3189 by extending the @rjsf/validator-ajv8 to support the Ajv2019 and Ajv2020 classes

  • Updated the CustomValidatorOptionsType to add a new AjvClass option
  • Updated the createAjvInstance() function to use the AjvClass option is provided to create the Ajv class instance, falling back to the default Ajv
  • Updated the AJV8Validator to extract the AjvClass from the options and pass it to the createAjvInstance() function
  • Updated the tests to also test the Ajv2019 and Ajv2020 class instances
  • Updated the validation.md file to document the new AjvClass options, switching the examples over to tsx
  • Updated the playground to allow use of the two new schemas
  • Updated the CHANGELOG.md file accordingly

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

Screenshot 2022-10-21 at 8 17 56 AM

…ma Ajv classes

Fix rjsf-team#3189 by extending the `@rjsf/validator-ajv8` to support the `Ajv2019` and `Ajv2020` classes
- Updated the `CustomValidatorOptionsType` to add a new `AjvClass` option
- Updated the `createAjvInstance()` function to use the `AjvClass` option is provided to create the `Ajv` class instance, falling back to the default `Ajv`
- Updated the `AJV8Validator` to extract the `AjvClass` from the options and pass it to the `createAjvInstance()` function
- Updated the tests to also test the `Ajv2019` and `Ajv2020` class instances
- Updated the `validation.md` file to document the new `AjvClass` options, switching the examples over to `tsx`
- Updated the `CHANGELOG.md` file accordingly
@@ -394,13 +396,925 @@ describe("AJV8Validator", () => {
});
});
});
describe("default options, with Ajv2019", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@heath-freenome
I'm assuming this is all copy/paste with the new class? Let me know if I should take a closer look at this.

Copy link
Member Author

Choose a reason for hiding this comment

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

There was one notable change that I commented on, but yeah

@heath-freenome heath-freenome merged commit 1a9e719 into rjsf-team:main Oct 21, 2022
@heath-freenome heath-freenome deleted the fix-3189 branch October 21, 2022 15:57
@heath-freenome heath-freenome changed the title fix: #3189 by allowing the ajv 8 validator to alternate schema Ajv classes fix: #3189 by allowing the ajv 8 validator to use alternate schema Ajv classes Oct 21, 2022
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.

Support for dependentSchemas and dependentRequired
2 participants