Skip to content

feature request: button-add for non-required objects #600

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

Closed
2 tasks done
gdbassett opened this issue Jun 1, 2017 · 1 comment
Closed
2 tasks done

feature request: button-add for non-required objects #600

gdbassett opened this issue Jun 1, 2017 · 1 comment
Labels
possibly close To confirm if this issue can be closed

Comments

@gdbassett
Copy link

gdbassett commented Jun 1, 2017

Prerequisites

  • I have read the documentation;
  • In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.

Description

A schema may define a set of objects as properties. A subset of those properties may be required by the schema. Currently react-jsonschema-form expands all objects (required or not). It would save space to collapse objects not required and provide a button to add the object if desired. Additionally, if the unrequired object has required fields when present, the validator will require the required fields in the unrequired object be filled in (even though they are only required when the object exists).

Steps to Reproduce

sample JSFiddle

Expected behavior

Ideally, string 1 and object 1 would be displayed and object 2 would be collapsed so everything below it was not shown. String 3 would not be required because no object 2 had been created.

Actual behavior

All properties and subproperties are shown. String 3 is required even though object 2 is empty.

Version

0.48.2

@glasserc
Copy link
Contributor

glasserc commented Jun 8, 2017

Hi, thanks for your comment. I agree that this would be useful. We've had a longstanding wishlist item for collapsing fields or hiding them (#322/#324, #578, your own #598). I would be interested in reviewing a PR that added this feature if it could be done in a clean way.

@jacqueswho jacqueswho added the possibly close To confirm if this issue can be closed label Feb 24, 2022
@stale stale bot closed this as completed Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possibly close To confirm if this issue can be closed
Projects
None yet
Development

No branches or pull requests

3 participants