You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
…ression
Fixesrjsf-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
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: