-
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 not selecting correct default value for complex objects with the same property keys #4208
Comments
@Becaan thanks for the report, this is definitely a bug. The regular maintainers don't have much time to fix all issues, are you interested to investigate a fix? This looks similar to #3892, which dealt with |
Hi @nickgros I know you have labeled it as help wanted but is it possible to escalate this to the team and see if anyone can pick it up? We are relying on oneOf and have been facing the same issue. |
The issue we are seeing is that when we switch options, the default values are restored only for the fields that are common to both the options. Eg. Link In this example, when you switch from option-1 to option-2 and then back to option-1, default value for |
@Becaan We took another look at your schema and realized that the issue is that the |
@Writingsinfo @heath-freenome is going to have a PR soon that will hopefully fix your issue in #4322 |
Thank you @nickgros and @heath-freenome for jumping on it so quickly. |
Prerequisites
What theme are you using?
core
Version
5.x
Current Behavior
As you can see in this example: https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJQbGFuSWQiOiIxMjMiLCJTdW0gSW5zdXJlZCI6IjkwMDAiLCJIZWFydCBhbmQgVmFzY3VsYXIgU3lzdGVtIjp7IlN1bSBJbnN1cmVkIjoiMTIwMCJ9fSwic2NoZW1hIjp7InR5cGUiOiJvYmplY3QiLCJvbmVPZiI6W3sidGl0bGUiOiJQbGFuIiwicHJvcGVydGllcyI6eyJQbGFuSWQiOnsidHlwZSI6InN0cmluZyIsImRlZmF1bHQiOiI2MSIsInJlYWRPbmx5Ijp0cnVlfSwiU3VtIEluc3VyZWQiOnsidHlwZSI6InN0cmluZyIsImRlZmF1bHQiOiIxMjAwIiwicGF0dGVybiI6Il5bMC05XXsxLDIwMn0oXFwuWzAtOV17MSwyM30pPyQifSwiSGVhcnQgYW5kIFZhc2N1bGFyIFN5c3RlbSI6eyJwcm9wZXJ0aWVzIjp7IlN1bSBJbnN1cmVkIjp7InR5cGUiOiJzdHJpbmciLCJkZWZhdWx0IjoiMTIwMCIsInBhdHRlcm4iOiJeWzAtOV17MSwyMDJ9KFxcLlswLTldezEsMjN9KT8kIn19fX19LHsidGl0bGUiOiJOZXcgUGxhbiIsInByb3BlcnRpZXMiOnsiUGxhbklkIjp7InR5cGUiOiJzdHJpbmciLCJkZWZhdWx0IjoiMTIzIiwicmVhZE9ubHkiOnRydWV9LCJTdW0gSW5zdXJlZCI6eyJ0eXBlIjoic3RyaW5nIiwiZGVmYXVsdCI6IjkwMDAiLCJwYXR0ZXJuIjoiXlswLTldezEsMjAyfShcXC5bMC05XXsxLDIzfSk/JCJ9LCJIZWFydCBhbmQgVmFzY3VsYXIgU3lzdGVtIjp7InByb3BlcnRpZXMiOnsiU3VtIEluc3VyZWQiOnsidHlwZSI6InN0cmluZyIsImRlZmF1bHQiOiI5MDAwIiwicGF0dGVybiI6Il5bMC05XXsxLDIwMn0oXFwuWzAtOV17MSwyM30pPyQifX19fX1dfSwidWlTY2hlbWEiOnt9LCJ0aGVtZSI6Im1hdGVyaWFsLXVpLTUiLCJsaXZlU2V0dGluZ3MiOnt9fQ==
The default value for complex object is not taken into account at all as well as pattern for example which i tried also.
So basically. "Sum Insured" that is a part of "Heart and Vascular System" always has the same default value of 1200 even though in jsonSchema default value for "New Plan" is set to 9000.
The behaviour that it should follow should be like the "Sum Insured" that is outside of "Heart and Vascular System".
TLDR: "Sum Insured" inside the "Heart and Vascular System" should have default value 9000 previewed when selecting "New Plan"
Expected Behavior
"Sum Insured" inside the "Heart and Vascular System" should have default value 9000 previewed when selecting "New Plan"
Steps To Reproduce
https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJQbGFuSWQiOiI2MSIsIlN1bSBJbnN1cmVkIjoiMTIwMCIsIkhlYXJ0IGFuZCBWYXNjdWxhciBTeXN0ZW0iOnsiU3VtIEluc3VyZWQiOiIxMjAwIn19LCJzY2hlbWEiOnsidHlwZSI6Im9iamVjdCIsIm9uZU9mIjpbeyJ0aXRsZSI6IlBsYW4iLCJwcm9wZXJ0aWVzIjp7IlBsYW5JZCI6eyJ0eXBlIjoic3RyaW5nIiwiZGVmYXVsdCI6IjYxIiwicmVhZE9ubHkiOnRydWV9LCJTdW0gSW5zdXJlZCI6eyJ0eXBlIjoic3RyaW5nIiwiZGVmYXVsdCI6IjEyMDAiLCJwYXR0ZXJuIjoiXlswLTldezEsMjAyfShcXC5bMC05XXsxLDIzfSk/JCJ9LCJIZWFydCBhbmQgVmFzY3VsYXIgU3lzdGVtIjp7InByb3BlcnRpZXMiOnsiU3VtIEluc3VyZWQiOnsidHlwZSI6InN0cmluZyIsImRlZmF1bHQiOiIxMjAwIiwicGF0dGVybiI6Il5bMC05XXsxLDIwMn0oXFwuWzAtOV17MSwyM30pPyQifX19fX0seyJ0aXRsZSI6Ik5ldyBQbGFuIiwicHJvcGVydGllcyI6eyJQbGFuSWQiOnsidHlwZSI6InN0cmluZyIsImRlZmF1bHQiOiIxMjMiLCJyZWFkT25seSI6dHJ1ZX0sIlN1bSBJbnN1cmVkIjp7InR5cGUiOiJzdHJpbmciLCJkZWZhdWx0IjoiOTAwMCIsInBhdHRlcm4iOiJeWzAtOV17MSwyMDJ9KFxcLlswLTldezEsMjN9KT8kIn0sIkhlYXJ0IGFuZCBWYXNjdWxhciBTeXN0ZW0iOnsicHJvcGVydGllcyI6eyJTdW0gSW5zdXJlZCI6eyJ0eXBlIjoic3RyaW5nIiwiZGVmYXVsdCI6IjkwMDAiLCJwYXR0ZXJuIjoiXlswLTldezEsMjAyfShcXC5bMC05XXsxLDIzfSk/JCJ9fX19fV19LCJ1aVNjaGVtYSI6e30sInRoZW1lIjoibWF0ZXJpYWwtdWktNSIsImxpdmVTZXR0aW5ncyI6e319
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: