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(@rjsf/core): Nested into items schema allOf blocks with multiple … #3025

Closed
wants to merge 1 commit into from

Conversation

AlimovSV
Copy link

…if/then/else statements fail to render correctly

When schema (or subschema) has allOf in the root AND has an array field with a property where exists allOf with few conditions RJSF doesn't handle this case properly. The console shows the warning could not merge subschemas in allOf and dependent properties don't reflect the schema. This is an example - if you remove root allOf the playground example will work.

After diving into the RJSF source code and looking around at dependent libraries, I found the solution, which makes these schemas work.

I'm not sure about any regression this change may introduce, but it works for the first look. All tests (except the fixed one that checked a nested merging allOf blocks) pass. All my schemas (including schemas that required #2839) works

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

…if/then/else statements fail to render correctly
@AlimovSV
Copy link
Author

Btw, I didn't include updated lock files in this PR because they were totally different. The versions in the repo are using space-based indents but my npm generated tab-based indents. Also, there were a lot of other changes that upgrading of the json-schema-merge-allof package should not add.

@heath-freenome
Copy link
Collaborator

heath-freenome commented Aug 19, 2022

@AlimovSV FYI, the upcoming beta (landing in about a week) completely refactors all of this code in breaking ways. If you'd like to make the fix in a code base that is currently active (the master branch is locked until the rjsf-v5 branch merges into it), then please take a look at rjsf-v5 and make a similar change in the @rjsf/utils package there.

@heath-freenome heath-freenome added v5 refactor Needs refactor due to v5 breaking changes any-one-all-of Related to fixing anyOf, oneOf or allOf labels Sep 15, 2022
@heath-freenome heath-freenome added the p1 Important to fix soon label Sep 28, 2022
@nickgros nickgros self-requested a review October 14, 2022 15:43
nickgros added a commit that referenced this pull request Dec 22, 2022
Co-authored-by: Sergey Alimov <sergey.alimov@gmail.com>
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
Fixes #2923
@nickgros
Copy link
Contributor

Closing since #3227 was merged

@nickgros nickgros closed this Dec 23, 2022
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
…am#3025) (rjsf-team#3227)

Co-authored-by: Sergey Alimov <sergey.alimov@gmail.com>
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
Fixes rjsf-team#2923
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
…am#3025) (rjsf-team#3227)

Co-authored-by: Sergey Alimov <sergey.alimov@gmail.com>
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
Fixes rjsf-team#2923
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
any-one-all-of Related to fixing anyOf, oneOf or allOf p1 Important to fix soon v5 refactor Needs refactor due to v5 breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants