-
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
Support optional objects #465
Comments
Yeah, I've worked on a patch to make fields collapsible in the past but it was discarded in favor of theming; maybe we'd want to resurect it at some point, as this use case still seems valid to me. |
@mfulton26 would the example from the docs work for you here? https://jsfiddle.net/69z2wepo/68259/ |
I suppose although it does alter the schema and it seems like a lot of overhead if I have many optional objects. |
In fact the form actually also validates wrong in this case which is very annoying. When defining an optional object inside the schema which has required fields the required fields always get validated although the schema would allow the whole object not to be there. (#331) |
I just had the same problem described here and in #331; a workaround seems to be to specify the property as type |
Modifies the implementation of `getSchemaType` so that when a property has a type of `[<any>, 'null']`, then `<any>` will be passed. This allows the library to render and validate the field correctly. For the sake of simplicity, this change does not attempt any further assumptions, coercions or transformations. References rjsf-team#465
* Basic support for 'nullable' types Modifies the implementation of `getSchemaType` so that when a property has a type of `[<any>, 'null']`, then `<any>` will be passed. This allows the library to render and validate the field correctly. For the sake of simplicity, this change does not attempt any further assumptions, coercions or transformations. References #465 * Add some test cases to `getSchemaType` spec * Add FAQ entry detailing nullable type behaviour * Add Playground example for nullable field * Tweak FAQ entry wording and fix typo Co-Authored-By: warrenseymour <warren@fountainhead.tech> * Correct example in FAQ entry Co-Authored-By: warrenseymour <warren@fountainhead.tech>
Closing this in favor of #675 |
Prerequisites
Description
Add support for not specifying an optional object property.
Steps to Reproduce
https://jsfiddle.net/f2y3fq7L/19/
Expected behavior
Have some sort of checkbox or something to enable/disable specifying the optional object property.
Actual behavior
There is no apparent way to not specify the optional object property.
Version
0.42.0
The text was updated successfully, but these errors were encountered: