react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

multiple oneOf dependency on one field

Open parsapordel opened this issue 6 years ago • 5 comments
trafficstars

Prerequisites

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

Description

dependencies in schema should be type array so it can support multiple oneOf on same field like this. but it is actually like this so you can't add a third field like z that depends on x I know it can be handled like this but in large cases like this it requires to get all intersection of fields and its hard

Expected behavior

I want to be able to use multiple fields that depend on one field

Actual behavior

I can only use one dependency for each field

Version

version==1.1.0

parsapordel avatar Jan 13 '19 07:01 parsapordel

I don't think we'll be able to implement that, because having an array for values in each object in the dependencies array is not part of the JSON Schema spec.

epicfaace avatar Jan 24 '19 19:01 epicfaace

I don't think we need oneOf type to be an array. Schema dependencies already add all properties. Try this.

glasserc avatar Feb 04 '19 17:02 glasserc

@epicfaace Is it possible to have multiple dependencies?.. If two fields or two checkboxes are checked..only then will a field or check box come up...

KailasRJ-Neoito avatar Jan 25 '22 17:01 KailasRJ-Neoito

Yes, but in that case you might not be able to use dependencies, but you might need to use oneOf instead (https://json-schema.org/understanding-json-schema/reference/combining.html#oneof).

epicfaace avatar Jan 25 '22 20:01 epicfaace

This issue has been automatically marked as possibly close because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.

stale[bot] avatar Jun 04 '24 00:06 stale[bot]

This issue was closed because of lack of recent activity. Reopen if you still need assistance.

stale[bot] avatar Jul 04 '24 02:07 stale[bot]