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: Added support for anyOf/oneOf in uiSchema #4055

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

heath-freenome
Copy link
Member

@heath-freenome heath-freenome commented Jan 19, 2024

Reasons for making this change

Fixes #4039 by updating MultiSchemaField to properly support anyOf/oneOf arrays in the uiSchema

  • In @rjsf/utils: Improved documentation and typescript ignores in tests related to base64 from previous PR
  • In @rjsf/core: Updated MultiSchemaField to support anyOf/oneOf arrays in the uiSchema
    • Updated the tests to verify the new feature
    • Also, did some work to synchronize tests that were in the anyOf.test.jsx and missing in the oneOf.test.jsx and vica-versa
  • In docs: Added documentation to the uiSchema.md file describing how to use the new feature
  • Updated the CHANGELOG.md 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

Fixes rjsf-team#4039 by updating `MultiSchemaField` to properly support `anyOf`/`oneOf` arrays in the `uiSchema`
- In `@rjsf/utils`: Improved documentation and typescript ignores in tests related to `base64` from previous PR
- In `@rjsf/core`: Updated `MultiSchemaField` to support `anyOf`/`oneOf` arrays in the `uiSchema`
  - Updated the tests to verify the new feature
- In `docs`: Added documentation to the `uiSchema.md` file describing how to use the new feature
- Updated the `CHANGELOG.md` accordingly
Copy link
Contributor

@nickgros nickgros left a comment

Choose a reason for hiding this comment

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

LGTM, was a bit confused about one of the tests unrelated to the new feature

expect(selects[1].value).eql('0');
});

it('should correctly update inputs for oneOf inside array items after being moved down', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably one of the anyOf tests that you just moved over but I don't understand what specific behavior this test supposed to verify

Copy link
Member Author

Choose a reason for hiding this comment

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

It was one of the ones that I moved over. Not sure what it is testing either

@heath-freenome heath-freenome merged commit 53b3c57 into rjsf-team:main Jan 23, 2024
4 checks passed
@nickgros nickgros mentioned this pull request Jan 23, 2024
4 tasks
nickgros added a commit that referenced this pull request Apr 19, 2024
Co-authored-by: Heath C <[email protected]>
Co-authored-by: Abdallah Al-Soqatri <[email protected]>
Co-authored-by: Kevin Burnett <[email protected]>
Co-authored-by: Marek Bodinger <[email protected]>
Co-authored-by: Mehdi Salem <[email protected]>
Co-authored-by: Jonasz Wiącek <[email protected]>
Co-authored-by: Bogdan Savluk <[email protected]>
Co-authored-by: Christian Wendt <[email protected]>
Co-authored-by: Ben Lambert <[email protected]>
Co-authored-by: David R. Bild <[email protected]>
Co-authored-by: Ariqun <[email protected]>
Co-authored-by: Shivam Anand Murmu <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Shubham Biswas <[email protected]>
Co-authored-by: popmanhe <[email protected]>
Co-authored-by: Yuki Aoki <[email protected]>
Co-authored-by: Xiangcheng Kuo <[email protected]>
Co-authored-by: Bart van Andel <[email protected]>
Co-authored-by: Laurent Direr <[email protected]>
Co-authored-by: Vegard Stenvik <[email protected]>
Co-authored-by: Appie <[email protected]>
Co-authored-by: Oren Forer <[email protected]>
Co-authored-by: Marcus Penn <[email protected]>
Co-authored-by: joachimhagheim <[email protected]>
Co-authored-by: MarekBodingerBA <[email protected]>
Co-authored-by: momesana <[email protected]>
Co-authored-by: Martti Roitto <[email protected]>
fix(utils): direct lodash function import to improve bundling on library client side (#3976)
fix: #3961 resolve all recurse list for object properties (#3981)
fix gap in outline when label is hidden (#3984)
Fix: Expose the internal `ajv` variable in the validator implementation classes (#3991)
Fixes: #3972 indirectly by exposing the `ajv` variable for use in the issue
Fix: Change FormHelperText usage with @mui/material to render divs (#4032)
Fixes #4031 by switching the render component for `FormHelperText` to be `div`
fix: Added support for anyOf/oneOf in uiSchema (#4055)
Fixes #4039 by updating `MultiSchemaField` to properly support `anyOf`/`oneOf` arrays in the `uiSchema`
Fix checkbox with 0 as a value was unselectable in antd (#4068)
Fixed #4067 by properly dealing with enums that have 0 as a value
Fix potential XSS in the preview button of FileWidget (#4065)
Fix: Make 'ui:rows' option work with chakra-ui for textarea elements #4070 (#4078)
Fix typo in ErrorsListTemplate example (#4087)
Fix #4080 by moving `base64` encoder/decoder from `@rjsf/utils` to playground (#4093)
Fix: Error state not resetting when schema changes (#4079) (#4103)
Fix noImplicitAny error (#4106)
Fixes: [WARNING] Duplicate key "include" in object literal [duplicate-object-key] (#4114)
Fixes: Warning: validateDOMNesting(...): <p> cannot appear as a descendant of <p>. (#4117)
Fix documentation to add missing Form imports (#4131)
Fix #4127 to add missing `Form` import in documentation
Fix: filename should be bold (#4125)
Fix: use correct ConfigProvider context by using named imports (#4132)
Fix 4134 by filtering out bad DOM props (#4140)
Fixes: #4134 by updating the spreading of props onto the `TextField` to remove bad DOM fields
Fixed Programmatic submit not working properly in Firefox (#4150)
Fix Maximum call stack size exceeded in findSchemaDefinition (#4123)
nickgros added a commit that referenced this pull request Aug 18, 2024
Co-authored-by: Heath C <[email protected]>
Co-authored-by: Abdallah Al-Soqatri <[email protected]>
Co-authored-by: Kevin Burnett <[email protected]>
Co-authored-by: Marek Bodinger <[email protected]>
Co-authored-by: Mehdi Salem <[email protected]>
Co-authored-by: Nick Grosenbacher <[email protected]>
Co-authored-by: Abdallah Al-Soqatri <[email protected]>
Co-authored-by: Jonasz Wiącek <[email protected]>
Co-authored-by: Bogdan Savluk <[email protected]>
Co-authored-by: Christian Wendt <[email protected]>
Co-authored-by: Ben Lambert <[email protected]>
Co-authored-by: David R. Bild <[email protected]>
Co-authored-by: Ariqun <[email protected]>
Co-authored-by: Shivam Anand Murmu <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Shubham Biswas <[email protected]>
Co-authored-by: popmanhe <[email protected]>
Co-authored-by: Yuki Aoki <[email protected]>
Co-authored-by: Xiangcheng Kuo <[email protected]>
Co-authored-by: Bart van Andel <[email protected]>
Co-authored-by: Laurent Direr <[email protected]>
Co-authored-by: Vegard Stenvik <[email protected]>
Co-authored-by: Appie <[email protected]>
Co-authored-by: Oren Forer <[email protected]>
Co-authored-by: Marcus Penn <[email protected]>
Co-authored-by: joachimhagheim <[email protected]>
Co-authored-by: MarekBodingerBA <[email protected]>
Co-authored-by: momesana <[email protected]>
Co-authored-by: Martti Roitto <[email protected]>
Co-authored-by: Serge van den Oever <[email protected]>
Co-authored-by: Enzo Ferey <[email protected]>
Co-authored-by: Skyf0l <[email protected]>
Co-authored-by: Jaejoon Han <[email protected]>
Co-authored-by: とまとみ <[email protected]>
Co-authored-by: Daniel Todd <[email protected]>
Co-authored-by: Dmitry Dzhus <[email protected]>
Co-authored-by: Alexander Kachkaev <[email protected]>
Co-authored-by: shaddollxz <[email protected]>
Co-authored-by: Changyu Geng <[email protected]>
Co-authored-by: Helen Lin <[email protected]>
Co-authored-by: solimant <[email protected]>
Co-authored-by: David Li <[email protected]>
fix(utils): direct lodash function import to improve bundling on library client side (#3976)
fix: #3961 resolve all recurse list for object properties (#3981)
fix gap in outline when label is hidden (#3984)
Fix: Expose the internal `ajv` variable in the validator implementation classes (#3991)
Fixes: #3972 indirectly by exposing the `ajv` variable for use in the issue
Fix: Change FormHelperText usage with @mui/material to render divs (#4032)
Fixes #4031 by switching the render component for `FormHelperText` to be `div`
fix: Added support for anyOf/oneOf in uiSchema (#4055)
Fixes #4039 by updating `MultiSchemaField` to properly support `anyOf`/`oneOf` arrays in the `uiSchema`
Fix checkbox with 0 as a value was unselectable in antd (#4068)
Fixed #4067 by properly dealing with enums that have 0 as a value
Fix potential XSS in the preview button of FileWidget (#4065)
Fix: Make 'ui:rows' option work with chakra-ui for textarea elements #4070 (#4078)
Fix typo in ErrorsListTemplate example (#4087)
Fix #4080 by moving `base64` encoder/decoder from `@rjsf/utils` to playground (#4093)
Fix: Error state not resetting when schema changes (#4079) (#4103)
Fix noImplicitAny error (#4106)
Fixes: [WARNING] Duplicate key "include" in object literal [duplicate-object-key] (#4114)
Fixes: Warning: validateDOMNesting(...): <p> cannot appear as a descendant of <p>. (#4117)
Fix documentation to add missing Form imports (#4131)
Fix #4127 to add missing `Form` import in documentation
Fix: filename should be bold (#4125)
Fix: use correct ConfigProvider context by using named imports (#4132)
Fix 4134 by filtering out bad DOM props (#4140)
Fixes: #4134 by updating the spreading of props onto the `TextField` to remove bad DOM fields
Fixed Programmatic submit not working properly in Firefox (#4150)
Fix Maximum call stack size exceeded in findSchemaDefinition (#4123)
fix typos in constants.ts, Form.tsx (#4185)
Fix mui imports in docs (#4218)
fix] Resetting number fields should check the entire string when deciding to leave the input text alone (#4202) (#4220)
Fixed performance issue with large schema dependencies and oneOf (#4203) (#4204)
Fixed performance issue #4203
fix(core): field ui-options higher priority (#4212)
fix(antd): disabled property of options of antd theme (#4216)
fix: omitExtraData on submit and on validateForm (#4228)
Fix IdSchema and PathSchema types (#4196)
fixes #4236
Fix #4197 in various themes by showing empty option in SelectWidget when appropriate (#4200)
fix: xss when rendering schema errors (#4256)
fix 4215 and 4260 by updating optionsList() to take a uiSchema (#4263)
Fixes #4215 and #4260 by supporting alternate titles for enums and anyOf/oneOf lists via the uiSchema
Fixed Changelog (#4269)
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.

UI Schema for anyOf with $refs
2 participants