-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
oneOf change of default behaviour #4377
Labels
Comments
jam13
added
bug
needs triage
Initial label given, to be assigned correct labels and assigned
labels
Nov 12, 2024
Duplicate of #4361 |
heath-freenome
added a commit
to heath-freenome/react-jsonschema-form
that referenced
this issue
Nov 14, 2024
…ression Fixes rjsf-team#4344, rjsf-team#4361 and rjsf-team#4377 - In `@rjsf/utils`: - Updated the `Experimental_DefaultFormStateBehavior` type to add new optional `constAsDefaults` prop with three choices - Updated `getDefaultFormState()` to respond to the new `constAsDefaults` feature to limit `const` as defaults based on the `never` or `skipOneOf` choices - Added tests for `getDefaultFormState()` to verify the new feature - In `@rjsf/core`: - Updated `SchemaField` to remove making the field readonly when const - In `playground`: - Updated `Header` to add support for `constAsDefaults` - Updated the `CHANGELOG.md` accordingly
8 tasks
heath-freenome
added a commit
that referenced
this issue
Nov 15, 2024
…ression (#4381) Fixes #4344, #4361 and #4377 - In `@rjsf/utils`: - Updated the `Experimental_DefaultFormStateBehavior` type to add new optional `constAsDefaults` prop with three choices - Updated `getDefaultFormState()` to respond to the new `constAsDefaults` feature to limit `const` as defaults based on the `never` or `skipOneOf` choices - Added tests for `getDefaultFormState()` to verify the new feature - In `@rjsf/core`: - Updated `SchemaField` to remove making the field readonly when const - In `playground`: - Updated `Header` to add support for `constAsDefaults` - Updated the `CHANGELOG.md` accordingly
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
Nov 22, 2024
This will be fixed with the new constAsDefaults feature coming in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
What theme are you using?
antd
Version
5.x
Current Behavior
oneOf used to behave like enum in that it defaulted to undefined unless a default had been specified. It is now defaulting to the first item in the oneOf list.
Expected Behavior
oneOf should behave the same as enum and default to undefined.
Steps To Reproduce
https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJvbmVPZk5vRGVmYXVsdCI6InllcyIsIm9uZU9mTnVsbERlZmF1bHQiOm51bGx9LCJzY2hlbWEiOnsidHlwZSI6Im9iamVjdCIsInByb3BlcnRpZXMiOnsiZW51bU5vRGVmYXVsdCI6eyJ0aXRsZSI6ImVudW1OYW1lcywgbm8gZGVmYXVsdCIsImVudW0iOlsieWVzIiwibm8iXX0sIm9uZU9mTm9EZWZhdWx0Ijp7InRpdGxlIjoib25lT2YsIG5vIGRlZmF1bHQiLCJ0eXBlIjoic3RyaW5nIiwib25lT2YiOlt7ImNvbnN0IjoieWVzIiwidGl0bGUiOiJZZXMifSx7ImNvbnN0Ijoibm8iLCJ0aXRsZSI6Ik5vIn1dfSwib25lT2ZOdWxsRGVmYXVsdCI6eyJ0eXBlIjoic3RyaW5nIiwidGl0bGUiOiJvbmVPZiwgbnVsbCBkZWZhdWx0IiwiZGVmYXVsdCI6bnVsbCwib25lT2YiOlt7ImNvbnN0IjoieWVzIiwidGl0bGUiOiJZZXMifSx7ImNvbnN0Ijoibm8iLCJ0aXRsZSI6Ik5vIn1dfX19LCJ1aVNjaGVtYSI6eyJlbnVtTm9EZWZhdWx0Ijp7InVpOndpZGdldCI6IlJhZGlvV2lkZ2V0IiwidWk6ZW51bU5hbWVzIjpbIlllcyIsIk5vIl19LCJvbmVPZk5vRGVmYXVsdCI6eyJ1aTp3aWRnZXQiOiJSYWRpb1dpZGdldCJ9LCJvbmVPZk51bGxEZWZhdWx0Ijp7InVpOndpZGdldCI6IlJhZGlvV2lkZ2V0In19LCJ0aGVtZSI6ImRlZmF1bHQiLCJsaXZlU2V0dGluZ3MiOnsic2hvd0Vycm9yTGlzdCI6InRvcCIsImV4cGVyaW1lbnRhbF9kZWZhdWx0Rm9ybVN0YXRlQmVoYXZpb3IiOnsiYXJyYXlNaW5JdGVtcyI6eyJwb3B1bGF0ZSI6InBvcHVsYXRlIiwibWVyZ2VFeHRyYURlZmF1bHRzIjpmYWxzZX0sImFsbE9mIjoic2tpcERlZmF1bHRzIiwiZW1wdHlPYmplY3RGaWVsZHMiOiJwb3B1bGF0ZUFsbERlZmF1bHRzIiwibWVyZ2VEZWZhdWx0c0ludG9Gb3JtRGF0YSI6InVzZUZvcm1EYXRhSWZQcmVzZW50In19fQ==
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: