JSON Forms Extended

Conditional object fields

Config opts in; local options.conditionalFields:false overrides it. All tabs edit the same data. Switch customerType to personal: nickname replaces VAT, and Name remains visible but is no longer required. Switch back: VAT is preserved. Remove purchaseOrder in the Data editor to deactivate its schema dependency; an empty string still counts as present. Billing address is retained in data. The second tab demonstrates freely placed branch-only fields in ordinary groups.

The third tab uses ordinary VerticalLayout, HorizontalLayout and Group elements without an object Control. The root Categorization enables conditional projection for its layout subtree. Name stays visible and its required star follows the business condition, while inactive branch-only controls disappear. All tabs edit the same data. Object Controls remain available for generated/registered details.

Enable options.conditionalFields on the first layout at the current object boundary, or use the global config default. Descendant layout settings do not reverse that owner's projection. A local false on the entry overrides global true. Nested objects and array items use their own schema/data context. Validation always uses the original schema. Hiding a field does not erase it or relax additionalProperties. In Draft-07, additionalProperties:false in the base schema does not recognize properties declared only in then/else: declare allowed names in the base schema when closing the object, and use explicit UI rules for visibility of those base fields.

This example supports graphical authoring through serializable control scopes, detail layouts and config. It does not include a drag-and-drop editor.

Additional acceptance cases in conformance/behavior.json cover conditions reached through allOf/$ref, ordinary allOf properties and required names without an if, and direct layouts whose schema type is ["object", "null"]. They reuse explicit name/vat/nickname placement. Business data requires name and vat; personal data replaces vat with nickname except in the unconditional allOf case. Nullable layouts must preserve null through null/object/null transitions. Separate reference-context cases check cache isolation, missing references and cycles. These are additional acceptance vectors rather than new tabs in the interactive example.