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: Switch to using isValid() for oneOf schema detection in retrieveSchema() #3575

Merged
merged 2 commits into from
Apr 5, 2023

Conversation

heath-freenome
Copy link
Member

Reasons for making this change

Added an optimization in retrieveSchema() to use the isValid() function rather than validateFormData()

  • In @rjsf/utils, switched the withExactlyOneSubschema() to use isValid()
    • Updated the test mocks 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

@heath-freenome heath-freenome force-pushed the switch-to-isValid branch 2 times, most recently from 4c2520a to 78383d8 Compare April 4, 2023 21:37
…Schema()

Added an optimization in `retrieveSchema()` to use the `isValid()` function rather than `validateFormData()`

- In `@rjsf/utils`, switched the `withExactlyOneSubschema()` to use `isValid()`
  - Updated the test mocks accordingly
@@ -209,7 +209,6 @@ describeRepeated('Form common', (createFormComponent) => {

it('should work with oneOf', function () {
const schema = {
$schema: 'http://json-schema.org/draft-06/schema#',
Copy link
Member Author

Choose a reason for hiding this comment

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

This caused compilation errors that broke the isValid() checks but didn't affect the old validateFormData() checks because that handled the error differently

@nickgros nickgros merged commit ff46301 into rjsf-team:main Apr 5, 2023
@heath-freenome heath-freenome deleted the switch-to-isValid branch April 5, 2023 00:57
cewald added a commit to spiribo/react-jsonschema-form that referenced this pull request Dec 16, 2024
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.

2 participants