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

Flesh out `anyOf` support

Open romancow opened this issue 1 year ago • 1 comments

Currently support for anyOf is a bit limited. I believe it's just a dropdown that switches child fields based on which "anyOf" option is selected. When a new one is selected, the previous set values persist. These should probably be "cleared out" whenever a new option is selected.

Actually, this would ideally be how the "oneOf" would work and "anyOf" would allow one to select multiple options and set the values for each of these (and clear out associated values when unselected). There are a few complications here to keep in mind - like there can be values for say, an object type, that are not part of the anyOf options. Also the different options could have overlapping values, where we probably want one field for this. Likewise you could have anyOfs without actual properties like outlined in issue #6 .

Probably want to look at how other similar libraries handle this (e.g. (react-jsonschema-form)[https://rjsf-team.github.io/react-jsonschema-form/] and (JSONForms)[https://jsonforms.io/]).

romancow avatar Sep 14 '23 20:09 romancow