balena-io-modules / jellyschema

JellySchema - data validation, UI form generation
Apache License 2.0
4 stars 2 forks source link

Fix problems with nested UISchema #68

Closed cyplo closed 5 years ago

cyplo commented 5 years ago

Fix a bug where non-top levels of UISchema were not produced properly.

This sometimes introduces empty non-top level UISchema objects, but this is compliant with how react-json-schema-form works. This can be optimized out later if we want to - see additional empty objects in the 2 test files.

The main fix was just to make UIObject recursive type to be able to hold all annotations or all levels, this information was already gathered during parsing, just not extracted out into UIObject during serialization.

While this works the code is not ideal, especially with regards to lifetimes - used clones to convince the borrow checker to compile but definitely needs more thought there later.

Fixes #48 Needed for #55