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

Using oneOf in replacement of enumNames doesn't render error component. #3921

Closed
4 tasks done
bmmpt opened this issue Oct 25, 2023 · 2 comments
Closed
4 tasks done

Using oneOf in replacement of enumNames doesn't render error component. #3921

bmmpt opened this issue Oct 25, 2023 · 2 comments
Labels
bug duplicate issue This issue is a duplicate of another one

Comments

@bmmpt
Copy link

bmmpt commented Oct 25, 2023

Prerequisites

What theme are you using?

core

Version

5.13.2

Current Behavior

In the example link from steps to reproduce, the required field error message displays for the Test field, which uses enumNames, but not for the Location field, which uses oneOf.

Expected Behavior

Expected the validation message to be displayed for the Location field, which uses oneOf.

Steps To Reproduce

https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6e30sInNjaGVtYSI6eyJ0eXBlIjoib2JqZWN0IiwicmVxdWlyZWQiOlsibG9jYXRpb24iLCJ0ZXN0Il0sInByb3BlcnRpZXMiOnsidGVzdCI6eyJ0aXRsZSI6IlRlc3QiLCJ0eXBlIjoibnVtYmVyIiwiZW51bSI6WzEsMl19LCJsb2NhdGlvbiI6eyJ0aXRsZSI6IkxvY2F0aW9uIiwidHlwZSI6InN0cmluZyIsIm9uZU9mIjpbeyJjb25zdCI6Ik5ldyBZb3JrIiwidGl0bGUiOiJOZXcgWW9yayJ9LHsiY29uc3QiOiJBbXN0ZXJkYW0iLCJ0aXRsZSI6IkFtc3RlcmRhbSJ9XX19fSwidWlTY2hlbWEiOnsiZmlyc3ROYW1lIjp7InVpOmF1dG9mb2N1cyI6dHJ1ZSwidWk6ZW1wdHlWYWx1ZSI6IiIsInVpOnBsYWNlaG9sZGVyIjoidWk6ZW1wdHlWYWx1ZSBjYXVzZXMgdGhpcyBmaWVsZCB0byBhbHdheXMgYmUgdmFsaWQgZGVzcGl0ZSBiZWluZyByZXF1aXJlZC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saXZlT21pdCI6ZmFsc2UsImV4cGVyaW1lbnRhbF9kZWZhdWx0Rm9ybVN0YXRlQmVoYXZpb3IiOnsiYXJyYXlNaW5JdGVtcyI6InBvcHVsYXRlIiwiZW1wdHlPYmplY3RGaWVsZHMiOiJwb3B1bGF0ZUFsbERlZmF1bHRzIn19fQ==

Environment

- OS:
- Node:
- npm:

Anything else?

I believe the issue is caused by this line of code:

hideError || schema.anyOf || schema.oneOf ? undefined : (

AnyOf/OneOf errors handled by child schema, but there is no child schema in this case.

@bmmpt bmmpt added bug needs triage Initial label given, to be assigned correct labels and assigned labels Oct 25, 2023
@heath-freenome heath-freenome added duplicate issue This issue is a duplicate of another one and removed needs triage Initial label given, to be assigned correct labels and assigned labels Oct 27, 2023
@heath-freenome
Copy link
Member

@bmmpt This is a duplicate of #3908. Sorry you ran into it. If you'd like to help fix this issue, we'd love a PR from you. Also, I am closing this as a duplicate.

@bmmpt
Copy link
Author

bmmpt commented Oct 30, 2023

@heath-freenome Sorry for creating a duplicate. The word "helper" on the other issue threw me off. I will circle back to this on Thursday and if @cwendtxealth hasn't gotten around fixing this, I will see if I can come up with an easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug duplicate issue This issue is a duplicate of another one
Projects
None yet
Development

No branches or pull requests

2 participants