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: Fixes 1295 Duplicate Error Messages for Anyof/Oneof #3795

Merged

Conversation

cwendtxealth
Copy link
Contributor

@cwendtxealth cwendtxealth commented Jul 28, 2023

Reasons for making this change

Fixes #1295, For anyOf/oneOf error messages were being shown at the top level anyOf/oneOf schema and the child schema that was resolved from the anyOf/oneOf logic. This PR updates SchemaField to only show error message at the child schema.

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
Copy link
Member

heath-freenome commented Jul 28, 2023

@cwendtxealth Can you post before/after Screenshots of the differences caused by the change?

@heath-freenome heath-freenome changed the title Fixes 1295 Duplicate Error Messages for Anyof/Oneof fix: Fixes 1295 Duplicate Error Messages for Anyof/Oneof Jul 28, 2023
@cwendtxealth
Copy link
Contributor Author

Before Fix
image
After Fix
image

Simulate.submit(node);

const matches = node.querySelectorAll('form .form-group .form-group .text-danger');
expect(matches).to.have.length.of(1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

before fix matches would have length 2

@heath-freenome heath-freenome merged commit 724e77c into rjsf-team:main Aug 1, 2023
4 checks passed
@cwendtxealth cwendtxealth deleted the fixes-1295-duplicate-anyof-errors branch August 1, 2023 18:28
@dashdots
Copy link

@cwendtxealth @heath-freenome This fix has caused an issue of Select components in antd, chakra-ui, and semantic theme packages that will not be validated.

@nickgros
Copy link
Contributor

@dashdots can you create a new issue?

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.

Duplicate error messages are shown inline when anyOf is used
4 participants