@chobantonov/jsonforms-extended-spec 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +126 -2
- package/conformance/authoring.json +2169 -0
- package/conformance/behavior.json +731 -0
- package/conformance/config-consumption.json +1531 -0
- package/conformance/expected-invalid.json +20 -0
- package/docs/audit.md +150 -0
- package/docs/conditional-fields.md +80 -0
- package/docs/draft-07-visual-support.md +43 -0
- package/docs/external-resources-proposal.md +536 -0
- package/docs/implementation-guide.md +180 -0
- package/docs/implementation-pitfalls.md +802 -0
- package/docs/implementation-web-typescript.md +41 -0
- package/docs/renderer-and-demo.md +1347 -0
- package/docs/renderer-selection.md +99 -0
- package/docs/spec.md +8321 -0
- package/docs/todo.md +149 -0
- package/examples/README.md +121 -0
- package/examples/additional-errors/README.md +169 -0
- package/examples/additional-errors/config.json +3 -0
- package/examples/additional-errors/data.json +11 -0
- package/examples/additional-errors/schema.json +56 -0
- package/examples/additional-errors/translations.json +64 -0
- package/examples/additional-errors/uischema.json +158 -0
- package/examples/additional-items-pagination/README.md +8 -0
- package/examples/additional-items-pagination/config.json +10 -0
- package/examples/additional-items-pagination/data.json +22 -0
- package/examples/additional-items-pagination/schema.json +30 -0
- package/examples/additional-items-pagination/translations.json +16 -0
- package/examples/additional-items-pagination/uischema.json +39 -0
- package/examples/additional-properties/README.md +188 -0
- package/examples/additional-properties/config.json +5 -0
- package/examples/additional-properties/data.json +31 -0
- package/examples/additional-properties/schema.json +78 -0
- package/examples/additional-properties/translations.json +80 -0
- package/examples/additional-properties/uischema.json +104 -0
- package/examples/ag-grid/README.md +62 -0
- package/examples/ag-grid/config.json +14 -0
- package/examples/ag-grid/data.json +124 -0
- package/examples/ag-grid/schema.json +48 -0
- package/examples/ag-grid/translations.json +58 -0
- package/examples/ag-grid/uischema.json +671 -0
- package/examples/array-choices/README.md +150 -0
- package/examples/array-choices/config.json +4 -0
- package/examples/array-choices/data.json +10 -0
- package/examples/array-choices/schema.json +68 -0
- package/examples/array-choices/translations.json +64 -0
- package/examples/array-choices/uischema.json +97 -0
- package/examples/array-controls/README.md +237 -0
- package/examples/array-controls/config.json +4 -0
- package/examples/array-controls/data.json +147 -0
- package/examples/array-controls/schema.json +374 -0
- package/examples/array-controls/translations.json +186 -0
- package/examples/array-controls/uischema.json +685 -0
- package/examples/array-detail-modes/README.md +11 -0
- package/examples/array-detail-modes/data.json +38 -0
- package/examples/array-detail-modes/schema.json +89 -0
- package/examples/array-detail-modes/translations.json +36 -0
- package/examples/array-detail-modes/uischema.json +73 -0
- package/examples/array-detail-modes/uischemas.d.mts +2 -0
- package/examples/array-detail-modes/uischemas.json +15 -0
- package/examples/boolean-controls/README.md +109 -0
- package/examples/boolean-controls/config.json +3 -0
- package/examples/boolean-controls/data.json +27 -0
- package/examples/boolean-controls/schema.json +98 -0
- package/examples/boolean-controls/translations.json +94 -0
- package/examples/boolean-controls/uischema.json +126 -0
- package/examples/button-actions/README.md +259 -0
- package/examples/button-actions/config.json +7 -0
- package/examples/button-actions/data.json +5 -0
- package/examples/button-actions/host.mjs +14 -0
- package/examples/button-actions/schema.json +20 -0
- package/examples/button-actions/translations.json +60 -0
- package/examples/button-actions/uischema.json +179 -0
- package/examples/catalog.json +634 -0
- package/examples/categorization/README.md +132 -0
- package/examples/categorization/config.json +7 -0
- package/examples/categorization/data.json +8 -0
- package/examples/categorization/schema.json +29 -0
- package/examples/categorization/translations.json +72 -0
- package/examples/categorization/uischema.json +288 -0
- package/examples/choice-controls/README.md +136 -0
- package/examples/choice-controls/config.json +10 -0
- package/examples/choice-controls/data.json +61 -0
- package/examples/choice-controls/schema.json +406 -0
- package/examples/choice-controls/translations.json +154 -0
- package/examples/choice-controls/uischema.json +575 -0
- package/examples/choice-controls/uischemas.d.mts +2 -0
- package/examples/choice-controls/uischemas.json +16 -0
- package/examples/code-editor/README.md +74 -0
- package/examples/code-editor/data.json +8 -0
- package/examples/code-editor/schema.json +28 -0
- package/examples/code-editor/translations.json +20 -0
- package/examples/code-editor/uischema.json +77 -0
- package/examples/collection-pagination/README.md +5 -0
- package/examples/collection-pagination/config.json +1 -0
- package/examples/collection-pagination/data.json +64 -0
- package/examples/collection-pagination/schema.json +23 -0
- package/examples/collection-pagination/translations.json +14 -0
- package/examples/collection-pagination/uischema.json +14 -0
- package/examples/color-control/README.md +151 -0
- package/examples/color-control/config.json +7 -0
- package/examples/color-control/data.json +11 -0
- package/examples/color-control/schema.json +61 -0
- package/examples/color-control/translations.json +76 -0
- package/examples/color-control/uischema.json +106 -0
- package/examples/combinators/README.md +223 -0
- package/examples/combinators/config.json +9 -0
- package/examples/combinators/data.json +23 -0
- package/examples/combinators/schema.json +232 -0
- package/examples/combinators/translations.json +178 -0
- package/examples/combinators/uischema.json +158 -0
- package/examples/conditional-fields/README.md +19 -0
- package/examples/conditional-fields/config.json +5 -0
- package/examples/conditional-fields/data.json +7 -0
- package/examples/conditional-fields/schema.json +59 -0
- package/examples/conditional-fields/translations.json +30 -0
- package/examples/conditional-fields/uischema.json +71 -0
- package/examples/container-validation-indicator/README.md +187 -0
- package/examples/container-validation-indicator/config.json +9 -0
- package/examples/container-validation-indicator/data.json +68 -0
- package/examples/container-validation-indicator/schema.json +222 -0
- package/examples/container-validation-indicator/translations.json +120 -0
- package/examples/container-validation-indicator/uischema.json +98 -0
- package/examples/cron-control/README.md +155 -0
- package/examples/cron-control/data.json +15 -0
- package/examples/cron-control/schema.json +72 -0
- package/examples/cron-control/translations.json +80 -0
- package/examples/cron-control/uischema.json +91 -0
- package/examples/destructive-confirmation/README.md +210 -0
- package/examples/destructive-confirmation/config.json +17 -0
- package/examples/destructive-confirmation/data.json +86 -0
- package/examples/destructive-confirmation/schema.json +204 -0
- package/examples/destructive-confirmation/translations.json +112 -0
- package/examples/destructive-confirmation/uischema.json +105 -0
- package/examples/draft-07-metaschema/README.md +11 -0
- package/examples/draft-07-metaschema/config.json +3 -0
- package/examples/draft-07-metaschema/data.json +25 -0
- package/examples/draft-07-metaschema/schema.json +172 -0
- package/examples/draft-07-metaschema/translations.json +10 -0
- package/examples/draft-07-metaschema/uischema.json +14 -0
- package/examples/dynamic-playground/README.md +95 -0
- package/examples/dynamic-playground/config.json +8 -0
- package/examples/dynamic-playground/configuration.json +152 -0
- package/examples/dynamic-playground/data.json +15 -0
- package/examples/dynamic-playground/dynamic-uischema.json +379 -0
- package/examples/dynamic-playground/host.mjs +37 -0
- package/examples/dynamic-playground/schema.json +48 -0
- package/examples/dynamic-playground/translations.json +76 -0
- package/examples/dynamic-playground/uischema.json +36 -0
- package/examples/editor-details/README.md +10 -0
- package/examples/editor-details/data.json +18 -0
- package/examples/editor-details/schema.json +49 -0
- package/examples/editor-details/translations.json +28 -0
- package/examples/editor-details/uischema.json +53 -0
- package/examples/editor-details/uischemas.d.mts +2 -0
- package/examples/editor-details/uischemas.json +14 -0
- package/examples/file-control/README.md +108 -0
- package/examples/file-control/data.json +28 -0
- package/examples/file-control/schema.json +89 -0
- package/examples/file-control/translations.json +46 -0
- package/examples/file-control/uischema.json +152 -0
- package/examples/group-layout/README.md +149 -0
- package/examples/group-layout/config.json +10 -0
- package/examples/group-layout/data.json +9 -0
- package/examples/group-layout/schema.json +51 -0
- package/examples/group-layout/translations.json +62 -0
- package/examples/group-layout/uischema.json +249 -0
- package/examples/index.d.ts +17 -0
- package/examples/index.js +69 -0
- package/examples/input-adornments/README.md +68 -0
- package/examples/input-adornments/data.json +41 -0
- package/examples/input-adornments/schema.json +207 -0
- package/examples/input-adornments/translations.json +106 -0
- package/examples/input-adornments/uischema.json +695 -0
- package/examples/job-application/README.md +23 -0
- package/examples/job-application/config.json +10 -0
- package/examples/job-application/data.json +68 -0
- package/examples/job-application/schema.json +196 -0
- package/examples/job-application/translations.json +388 -0
- package/examples/job-application/uischema.json +218 -0
- package/examples/job-application/uischemas.json +153 -0
- package/examples/json-editor/README.md +28 -0
- package/examples/json-editor/schema.json +1 -0
- package/examples/json-editor/translations.json +10 -0
- package/examples/json-editor/uischema.json +16 -0
- package/examples/json-inference/README.md +33 -0
- package/examples/json-inference/translations.json +10 -0
- package/examples/json-inference/uischema.json +16 -0
- package/examples/kitchen-sink/README.md +86 -0
- package/examples/kitchen-sink/config.json +14 -0
- package/examples/kitchen-sink/data.json +263 -0
- package/examples/kitchen-sink/invalid-data.json +263 -0
- package/examples/kitchen-sink/schema.json +515 -0
- package/examples/kitchen-sink/translations.json +270 -0
- package/examples/kitchen-sink/uischema.json +722 -0
- package/examples/label-interpolation/README.md +200 -0
- package/examples/label-interpolation/config.json +8 -0
- package/examples/label-interpolation/data.json +13 -0
- package/examples/label-interpolation/schema.json +64 -0
- package/examples/label-interpolation/translations.json +94 -0
- package/examples/label-interpolation/uischema.json +375 -0
- package/examples/layout-sizing/README.md +162 -0
- package/examples/layout-sizing/config.json +10 -0
- package/examples/layout-sizing/data.json +14 -0
- package/examples/layout-sizing/schema.json +58 -0
- package/examples/layout-sizing/translations.json +42 -0
- package/examples/layout-sizing/uischema.json +558 -0
- package/examples/markup-label/README.md +109 -0
- package/examples/markup-label/config.json +16 -0
- package/examples/markup-label/data.json +5 -0
- package/examples/markup-label/schema.json +24 -0
- package/examples/markup-label/translations.json +40 -0
- package/examples/markup-label/uischema.json +149 -0
- package/examples/mixed-control/README.md +164 -0
- package/examples/mixed-control/config.json +11 -0
- package/examples/mixed-control/data.json +70 -0
- package/examples/mixed-control/schema.json +221 -0
- package/examples/mixed-control/translations.json +158 -0
- package/examples/mixed-control/uischema.json +211 -0
- package/examples/null-control/README.md +111 -0
- package/examples/null-control/config.json +4 -0
- package/examples/null-control/data.json +6 -0
- package/examples/null-control/schema.json +36 -0
- package/examples/null-control/translations.json +42 -0
- package/examples/null-control/uischema.json +56 -0
- package/examples/numeric-controls/README.md +94 -0
- package/examples/numeric-controls/config.json +4 -0
- package/examples/numeric-controls/data.json +8 -0
- package/examples/numeric-controls/schema.json +52 -0
- package/examples/numeric-controls/translations.json +56 -0
- package/examples/numeric-controls/uischema.json +77 -0
- package/examples/object-control/README.md +220 -0
- package/examples/object-control/config.json +4 -0
- package/examples/object-control/data.json +62 -0
- package/examples/object-control/schema.json +252 -0
- package/examples/object-control/translations.json +160 -0
- package/examples/object-control/uischema.json +275 -0
- package/examples/object-control/uischemas.d.mts +2 -0
- package/examples/object-control/uischemas.json +59 -0
- package/examples/password-control/README.md +119 -0
- package/examples/password-control/config.json +3 -0
- package/examples/password-control/data.json +18 -0
- package/examples/password-control/schema.json +65 -0
- package/examples/password-control/translations.json +64 -0
- package/examples/password-control/uischema.json +94 -0
- package/examples/pre-touch-errors/README.md +176 -0
- package/examples/pre-touch-errors/config.json +4 -0
- package/examples/pre-touch-errors/data.json +5 -0
- package/examples/pre-touch-errors/schema.json +56 -0
- package/examples/pre-touch-errors/translations.json +68 -0
- package/examples/pre-touch-errors/uischema.json +85 -0
- package/examples/presentation/README.md +148 -0
- package/examples/presentation/config.json +9 -0
- package/examples/presentation/data.json +6 -0
- package/examples/presentation/schema.json +21 -0
- package/examples/presentation/translations.json +64 -0
- package/examples/presentation/uischema.json +210 -0
- package/examples/property-pagination/README.md +5 -0
- package/examples/property-pagination/config.json +1 -0
- package/examples/property-pagination/data.json +17 -0
- package/examples/property-pagination/schema.json +14 -0
- package/examples/property-pagination/translations.json +10 -0
- package/examples/property-pagination/uischema.json +24 -0
- package/examples/recursive-tree/README.md +49 -0
- package/examples/recursive-tree/config.json +1 -0
- package/examples/recursive-tree/data.json +40 -0
- package/examples/recursive-tree/schema.json +89 -0
- package/examples/recursive-tree/translations.json +42 -0
- package/examples/recursive-tree/uischema.json +84 -0
- package/examples/recursive-tree/uischemas.d.mts +2 -0
- package/examples/recursive-tree/uischemas.json +51 -0
- package/examples/split-layout/README.md +123 -0
- package/examples/split-layout/config.json +3 -0
- package/examples/split-layout/data.json +13 -0
- package/examples/split-layout/schema.json +50 -0
- package/examples/split-layout/translations.json +50 -0
- package/examples/split-layout/uischema.json +204 -0
- package/examples/string-controls/README.md +159 -0
- package/examples/string-controls/config.json +5 -0
- package/examples/string-controls/data.json +13 -0
- package/examples/string-controls/schema.json +70 -0
- package/examples/string-controls/translations.json +76 -0
- package/examples/string-controls/uischema.json +148 -0
- package/examples/table-row-details/README.md +69 -0
- package/examples/table-row-details/config.json +7 -0
- package/examples/table-row-details/data.json +280 -0
- package/examples/table-row-details/schema.json +61 -0
- package/examples/table-row-details/translations.json +56 -0
- package/examples/table-row-details/uischema.json +1303 -0
- package/examples/template-layout/README.md +250 -0
- package/examples/template-layout/config.json +9 -0
- package/examples/template-layout/data.json +20 -0
- package/examples/template-layout/host.mjs +13 -0
- package/examples/template-layout/schema.json +48 -0
- package/examples/template-layout/translations.json +70 -0
- package/examples/template-layout/uischema.json +177 -0
- package/examples/template-slots/README.md +19 -0
- package/examples/template-slots/data.json +4 -0
- package/examples/template-slots/schema.json +11 -0
- package/examples/template-slots/translations.json +26 -0
- package/examples/template-slots/uischema.json +47 -0
- package/examples/template-slots/uischemas.d.mts +2 -0
- package/examples/template-slots/uischemas.json +56 -0
- package/examples/temporal-controls/README.md +325 -0
- package/examples/temporal-controls/data.json +44 -0
- package/examples/temporal-controls/schema.json +208 -0
- package/examples/temporal-controls/translations.json +156 -0
- package/examples/temporal-controls/uischema.json +297 -0
- package/examples/tree-max-depth/README.md +5 -0
- package/examples/tree-max-depth/config.json +3 -0
- package/examples/tree-max-depth/data.json +31 -0
- package/examples/tree-max-depth/schema.json +258 -0
- package/examples/tree-max-depth/translations.json +42 -0
- package/examples/tree-max-depth/uischema.json +16 -0
- package/examples/tree-max-depth/uischemas.d.mts +2 -0
- package/examples/tree-max-depth/uischemas.json +50 -0
- package/examples/tuple-control/README.md +335 -0
- package/examples/tuple-control/config.json +4 -0
- package/examples/tuple-control/data.json +61 -0
- package/examples/tuple-control/schema.json +218 -0
- package/examples/tuple-control/translations.json +142 -0
- package/examples/tuple-control/uischema.json +128 -0
- package/examples/tuple-control/uischemas.d.mts +2 -0
- package/examples/tuple-control/uischemas.json +125 -0
- package/examples/validator-profile/README.md +197 -0
- package/examples/validator-profile/config.json +9 -0
- package/examples/validator-profile/data.json +16 -0
- package/examples/validator-profile/schema.json +139 -0
- package/examples/validator-profile/translations.json +34 -0
- package/examples/validator-profile/uischema.json +59 -0
- package/package.json +83 -3
- package/provenance.json +140 -0
- package/schemas/README.md +77 -0
- package/schemas/example.schema.json +37 -0
- package/schemas/jsonforms-config.schema.json +427 -0
- package/schemas/jsonforms-dynamic-uischema.schema.json +220 -0
- package/schemas/jsonforms-extended-config.schema.json +327 -0
- package/schemas/jsonforms-extended-uischema.schema.json +1923 -0
- package/schemas/jsonforms-rule.schema.json +104 -0
- package/schemas/jsonforms-uischema.schema.json +1421 -0
- package/typescript/README.md +540 -0
- package/typescript/lib/authoring/cssLength.d.ts +33 -0
- package/typescript/lib/authoring/cssLength.js +25 -0
- package/typescript/lib/authoring/dynamic.d.ts +73 -0
- package/typescript/lib/authoring/dynamic.js +8 -0
- package/typescript/lib/authoring/forSchema.d.ts +376 -0
- package/typescript/lib/authoring/forSchema.js +84 -0
- package/typescript/lib/authoring/schemaTypes.d.ts +111 -0
- package/typescript/lib/authoring/schemaTypes.js +15 -0
- package/typescript/lib/index.d.ts +4 -0
- package/typescript/lib/index.js +20 -0
- package/typescript/package.json +1 -0
- package/typescript/src/authoring/cssLength.ts +79 -0
- package/typescript/src/authoring/dynamic.ts +96 -0
- package/typescript/src/authoring/forSchema.ts +419 -0
- package/typescript/src/authoring/schemaTypes.ts +143 -0
- package/typescript/src/index.ts +4 -0
- package/typescript/test/schemaContract.test.ts +626 -0
- package/typescript/test/tsconfig.json +10 -0
- package/typescript/test/typedAuthoring.test.ts +140 -0
- package/typescript/test/typedAuthoringCoverage.test.ts +145 -0
- package/typescript/test/typedAuthoringCssLength.test.ts +81 -0
- package/typescript/test/typedAuthoringNames.test.ts +90 -0
- package/typescript/test/typedDynamic.test.ts +88 -0
- package/typescript/tsconfig.json +15 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "VerticalLayout",
|
|
3
|
+
"elements": [
|
|
4
|
+
{
|
|
5
|
+
"type": "Categorization",
|
|
6
|
+
"elements": [
|
|
7
|
+
{
|
|
8
|
+
"type": "Category",
|
|
9
|
+
"label": "Storage formats",
|
|
10
|
+
"i18n": "featureNavigation.section1",
|
|
11
|
+
"elements": [
|
|
12
|
+
{
|
|
13
|
+
"type": "Label",
|
|
14
|
+
"text": "One color, four stored representations. Pick a color, then read the Data tab."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "Control",
|
|
18
|
+
"scope": "#/properties/brandPrimary"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "Control",
|
|
22
|
+
"scope": "#/properties/accentColor",
|
|
23
|
+
"options": {
|
|
24
|
+
"colorSaveFormat": "rgb"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "Control",
|
|
29
|
+
"scope": "#/properties/chartSeries",
|
|
30
|
+
"options": {
|
|
31
|
+
"colorSaveFormat": "hsb"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "Control",
|
|
36
|
+
"scope": "#/properties/highlight"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "Category",
|
|
42
|
+
"label": "Transparency",
|
|
43
|
+
"i18n": "featureNavigation.section2",
|
|
44
|
+
"elements": [
|
|
45
|
+
{
|
|
46
|
+
"type": "Label",
|
|
47
|
+
"text": "Transparency"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"type": "Control",
|
|
51
|
+
"scope": "#/properties/watermark"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"type": "Control",
|
|
55
|
+
"scope": "#/properties/legacyBadge",
|
|
56
|
+
"options": {
|
|
57
|
+
"colorSaveFormat": "hex3"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "Category",
|
|
64
|
+
"label": "Picker options",
|
|
65
|
+
"i18n": "featureNavigation.section3",
|
|
66
|
+
"elements": [
|
|
67
|
+
{
|
|
68
|
+
"type": "Label",
|
|
69
|
+
"text": "Selection by UI option, and the picker on its own"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"type": "Control",
|
|
73
|
+
"scope": "#/properties/statusDot",
|
|
74
|
+
"options": {
|
|
75
|
+
"format": "color",
|
|
76
|
+
"colorSaveFormat": "rgb"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"type": "Control",
|
|
81
|
+
"scope": "#/properties/printSpot",
|
|
82
|
+
"options": {
|
|
83
|
+
"colorTextEntry": false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"type": "Category",
|
|
90
|
+
"label": "Invalid values",
|
|
91
|
+
"i18n": "featureNavigation.section4",
|
|
92
|
+
"elements": [
|
|
93
|
+
{
|
|
94
|
+
"type": "Label",
|
|
95
|
+
"text": "A value this profile does not recognize"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"type": "Control",
|
|
99
|
+
"scope": "#/properties/importedTint"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Example: combinators, and schema conditions
|
|
2
|
+
|
|
3
|
+
**Example ID:** `combinators`\
|
|
4
|
+
**Demo entry:** **Spec: Combinators and schema conditions** (`#spec-combinators`)\
|
|
5
|
+
**Domain:** a meeting-room request\
|
|
6
|
+
**Specs covered:**
|
|
7
|
+
|
|
8
|
+
- [Combinator controls: oneOf, anyOf, and allOf](../../docs/spec.md#1815-combinator-controls)
|
|
9
|
+
- [Conditional validation versus conditional presentation](../../docs/spec.md#1815-combinator-controls)
|
|
10
|
+
- [Required properties, markers, and clearing](../../docs/spec.md#1815-combinator-controls)
|
|
11
|
+
- [Shared destructive-change confirmation](../../docs/spec.md#1815-combinator-controls)
|
|
12
|
+
- [When a selection writes, and when it only displays](../../docs/spec.md#1815-combinator-controls)
|
|
13
|
+
|
|
14
|
+
Six categories, each answering one question the combinator section raises.
|
|
15
|
+
The last two are the ones worth reading twice: a schema condition and a UI
|
|
16
|
+
rule look like the same feature and are not — and the thing a schema *can*
|
|
17
|
+
decide on its own is not the thing people expect.
|
|
18
|
+
|
|
19
|
+
## Files
|
|
20
|
+
|
|
21
|
+
| File | Role |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `schema.json` | One property per presentation, two scalar compositions, a root-level `if`/`then`, and a discriminated `oneOf`. |
|
|
24
|
+
| `uischema.json` | A `Categorization`; the request number stays above it. No `rule` appears in the last tab, deliberately. |
|
|
25
|
+
| `data.json` | A valid request, so every failure below has to be produced deliberately. |
|
|
26
|
+
| `config.json` | `branchChange: "always"`, so the oneOf switch always asks. |
|
|
27
|
+
| `translations.json` | English and Bulgarian, including the composition error messages. |
|
|
28
|
+
|
|
29
|
+
## The three presentations
|
|
30
|
+
|
|
31
|
+
| Tab | Schema | What you see |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| **oneOf** | `contact`, with `name` beside two branches | A dropdown of branch labels, the selected branch's form below it. |
|
|
34
|
+
| **anyOf** | `location`, two branches | Tabs. No selector, and nothing to confirm. |
|
|
35
|
+
| **allOf** | `equipment`, `name` beside two branches | No selector at all: the enclosing property, then every branch in order. |
|
|
36
|
+
|
|
37
|
+
### oneOf: switching keeps the enclosing properties
|
|
38
|
+
|
|
39
|
+
Data starts as:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{ "name": "Alex Moreau", "kind": "email", "email": "alex.moreau@example.com" }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Switch to **Phone contact** and accept. The result is
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{ "name": "Alex Moreau", "kind": "phone", "phone": "" }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**`name` survives** because the enclosing schema declares it. **`email` does
|
|
52
|
+
not**, because it belongs to the branch being left. And `kind` — present in
|
|
53
|
+
*both* branches — is replaced, not preserved: the specification is explicit
|
|
54
|
+
that a shared property name is not a reason to keep a value.
|
|
55
|
+
|
|
56
|
+
Cancel and nothing moves, neither the data nor the selection.
|
|
57
|
+
|
|
58
|
+
### anyOf: navigating changes nothing
|
|
59
|
+
|
|
60
|
+
Move between **On site** and **Online** as often as you like. No prompt, no
|
|
61
|
+
write, no data lost — "the active tab is presentation state only". A value
|
|
62
|
+
carrying both a room and a platform satisfies `anyOf` perfectly well.
|
|
63
|
+
|
|
64
|
+
Which tab opens is derived from the data, but only until you pick one.
|
|
65
|
+
After that the choice is yours, even if your editing makes a different branch
|
|
66
|
+
fit.
|
|
67
|
+
|
|
68
|
+
### allOf: everything at once
|
|
69
|
+
|
|
70
|
+
`allOf` is an intersection, so there is nothing to select. **Item** comes
|
|
71
|
+
first as the enclosing property, then **Asset tag** and **In working order**
|
|
72
|
+
from the two branches, in schema order.
|
|
73
|
+
|
|
74
|
+
## Composition that describes one editor
|
|
75
|
+
|
|
76
|
+
The fourth tab holds two properties that are *not* a choice between forms:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{ "type": "integer", "anyOf": [{ "maximum": 12 }, { "minimum": 50 }] }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Up to 12 attendees, or 50 and over. That is one number with an unusual rule,
|
|
83
|
+
not two things to edit — so it renders as **one input**, labelled by the outer
|
|
84
|
+
property, with no tabs and no dropdown.
|
|
85
|
+
|
|
86
|
+
**Neither bound reaches the input.** Putting both on would make every value
|
|
87
|
+
invalid; picking one would forbid values the other branch allows. They are
|
|
88
|
+
left to validation, which is why typing `30` produces a message rather than
|
|
89
|
+
being prevented.
|
|
90
|
+
|
|
91
|
+
The second is the exclusive case:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{ "type": "integer", "oneOf": [{ "multipleOf": 3 }, { "multipleOf": 5 }] }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`6` and `10` pass. `15` fails *because it matches both* — and no branch
|
|
98
|
+
selector could have helped, which is exactly why there is not one.
|
|
99
|
+
|
|
100
|
+
## A schema condition is not a UI rule
|
|
101
|
+
|
|
102
|
+
The fifth tab is the point of the example.
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
"if": { "properties": { "urgent": { "const": true } }, "required": ["urgent"] },
|
|
106
|
+
"then": { "required": ["neededBy"] }
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`neededBy` is required when the request is urgent. That is **validation**.
|
|
110
|
+
|
|
111
|
+
The same property appears twice in the tab:
|
|
112
|
+
|
|
113
|
+
- under **With a UI rule**, carrying `rule: { effect: "SHOW", … }`;
|
|
114
|
+
- under **Without a UI rule**, carrying nothing.
|
|
115
|
+
|
|
116
|
+
Turn **Urgent request** off and only the first disappears. The schema
|
|
117
|
+
condition hides nothing — "A schema condition does not itself define a
|
|
118
|
+
SHOW/HIDE rule. Do not infer automatic conditional layouts from validator
|
|
119
|
+
support for if/then/else."
|
|
120
|
+
|
|
121
|
+
They are two mechanisms that have to be authored to agree. The `required`
|
|
122
|
+
entry inside `if` is part of that: without it, an *absent* `urgent` would
|
|
123
|
+
activate `then`.
|
|
124
|
+
|
|
125
|
+
### The asterisk that is not there
|
|
126
|
+
|
|
127
|
+
With **Urgent request** on and no date entered, the form is invalid and says
|
|
128
|
+
so — but **the field carries no required marker**.
|
|
129
|
+
|
|
130
|
+
That is a documented limit, not an oversight. The required marker comes from
|
|
131
|
+
the parent schema's `required` array, and a conditional requirement never
|
|
132
|
+
appears there: "a simple parent-required lookup does not infer that active
|
|
133
|
+
requirement for the marker." The specification's instruction is to document
|
|
134
|
+
the gap rather than claim uniform support, and "validation errors must remain
|
|
135
|
+
available even when a renderer cannot infer the corresponding required
|
|
136
|
+
marker" — which is why the message appears regardless.
|
|
137
|
+
|
|
138
|
+
## Showing and hiding fields from the schema
|
|
139
|
+
|
|
140
|
+
The previous tab is about **validation**. This one is about **which fields
|
|
141
|
+
exist**, and it is the part that surprises people: a schema *can* decide that,
|
|
142
|
+
and `if`/`then`/`else` is not how.
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
"appointment": {
|
|
146
|
+
"type": "object",
|
|
147
|
+
"properties": { "method": { "enum": ["collect", "post", "none"] } },
|
|
148
|
+
"oneOf": [
|
|
149
|
+
{ "title": "Collect in person", "properties": { "method": { "const": "collect" }, "collectionPoint": {…} }, "required": ["method"] },
|
|
150
|
+
{ "title": "By post", "properties": { "method": { "const": "post" }, "postcode": {…}, "addressLine": {…} }, "required": ["method"] },
|
|
151
|
+
{ "title": "Do not send", "properties": { "method": { "const": "none" } }, "required": ["method"] }
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Change **Method** and the fields change with it — a collection point, then a
|
|
157
|
+
postcode and an address, then nothing at all. **There is no `rule` anywhere in
|
|
158
|
+
that section of the UI schema**, and a test asserts as much, because the
|
|
159
|
+
whole claim is that the schema did it.
|
|
160
|
+
|
|
161
|
+
What does the work is the `const` discriminator: each `method` value matches
|
|
162
|
+
exactly one branch, so the branch that fits the value is the branch on screen.
|
|
163
|
+
|
|
164
|
+
A value left behind by a previous branch is **kept, not deleted**. Switch to
|
|
165
|
+
Post while a collection point is stored and the field goes away while the
|
|
166
|
+
value stays — only an explicit branch change through the dropdown discards
|
|
167
|
+
anything, and that asks first.
|
|
168
|
+
|
|
169
|
+
### Why `if`/`then`/`else` cannot do this
|
|
170
|
+
|
|
171
|
+
Three things were tried, and none of them hides a field:
|
|
172
|
+
|
|
173
|
+
| Attempt | What happens |
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| A Control scoped at a property declared only inside `then` | Renders **always**, as an unschema'd input. The scope resolves against the static schema, which has no such property, so the control falls back to the scope's last segment for a label. |
|
|
176
|
+
| Letting JSON Forms generate the UI schema | Generation reads `properties` only. A property declared under `then` gets no control at any time. |
|
|
177
|
+
| `if`/`then` on its own | Changes requiredness and validation. Nothing else. |
|
|
178
|
+
|
|
179
|
+
That first row is worth remembering, because it looks like it is working: the
|
|
180
|
+
field appears, it accepts typing, and it is bound to a path the schema never
|
|
181
|
+
described.
|
|
182
|
+
|
|
183
|
+
So the two mechanisms divide cleanly:
|
|
184
|
+
|
|
185
|
+
| To change… | Use |
|
|
186
|
+
| --- | --- |
|
|
187
|
+
| whether a value is **required**, or valid | `if` / `then` / `else` in the schema |
|
|
188
|
+
| whether a field is **on screen** | a `oneOf` / `anyOf` branch, or a UI `rule` |
|
|
189
|
+
|
|
190
|
+
## Expected behaviour
|
|
191
|
+
|
|
192
|
+
| Action | Result |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| Switch the oneOf branch, accept | Branch data replaced, `name` kept. |
|
|
195
|
+
| Switch the oneOf branch, decline | Nothing changes, selection included. |
|
|
196
|
+
| Switch the anyOf tab | Nothing at all is written; no prompt. |
|
|
197
|
+
| Enter 30 attendees | "Enter up to 12 attendees, or 50 and over." |
|
|
198
|
+
| Enter 15 seats per table | The exclusive-match message; both multiples are the problem. |
|
|
199
|
+
| Turn off Urgent | The ruled control goes; the unruled one stays. |
|
|
200
|
+
| Turn on Urgent, clear the date | Invalid, with a message and no asterisk. |
|
|
201
|
+
| Change **Method** to By post | The collection point goes, a postcode and address appear. No rule involved. |
|
|
202
|
+
| Change **Method** to Do not send | Only the method itself remains. |
|
|
203
|
+
|
|
204
|
+
## Fallback behaviour
|
|
205
|
+
|
|
206
|
+
| Situation | Result |
|
|
207
|
+
| --- | --- |
|
|
208
|
+
| Value matches no oneOf branch | A fallback branch is displayed with the errors, and the data is kept for correction. |
|
|
209
|
+
| Value matches several oneOf branches | One is displayed; the error stays, because displaying one does not resolve it. |
|
|
210
|
+
| No value at all | The dropdown may open with nothing selected; no defaults are written by mounting. |
|
|
211
|
+
| A composition this renderer cannot read as one editor | The branch presentation, unchanged. Nothing is lost by falling back. |
|
|
212
|
+
| A value that fits no branch | The displayed branch stays put, with the errors beside it — blanking the form would hide the field the correction needs. |
|
|
213
|
+
|
|
214
|
+
## Conformance scope
|
|
215
|
+
|
|
216
|
+
This walkthrough describes the portable contract. Renderer support must be checked
|
|
217
|
+
by a host adapter; the package validates the authored assets, not live UI behavior.
|
|
218
|
+
|
|
219
|
+
## Standalone host setup
|
|
220
|
+
|
|
221
|
+
Load the JSON assets listed in [the catalog](../catalog.json) into a host
|
|
222
|
+
with the relevant renderer capabilities. No framework registration module is
|
|
223
|
+
required by this package.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"reference": "REQ-40318",
|
|
3
|
+
"contact": {
|
|
4
|
+
"name": "Alex Moreau",
|
|
5
|
+
"kind": "email",
|
|
6
|
+
"email": "alex.moreau@example.com"
|
|
7
|
+
},
|
|
8
|
+
"location": {
|
|
9
|
+
"room": "Willow Room"
|
|
10
|
+
},
|
|
11
|
+
"equipment": {
|
|
12
|
+
"name": "Projector",
|
|
13
|
+
"assetTag": "AB1234",
|
|
14
|
+
"working": true
|
|
15
|
+
},
|
|
16
|
+
"attendees": 8,
|
|
17
|
+
"seatsPerTable": 6,
|
|
18
|
+
"urgent": false,
|
|
19
|
+
"appointment": {
|
|
20
|
+
"method": "collect",
|
|
21
|
+
"collectionPoint": "Main reception"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"reference": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"title": "Request number"
|
|
7
|
+
},
|
|
8
|
+
"contact": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"title": "Who to contact",
|
|
11
|
+
"properties": {
|
|
12
|
+
"name": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"title": "Contact name"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"oneOf": [
|
|
18
|
+
{
|
|
19
|
+
"title": "Email contact",
|
|
20
|
+
"properties": {
|
|
21
|
+
"kind": {
|
|
22
|
+
"const": "email",
|
|
23
|
+
"default": "email"
|
|
24
|
+
},
|
|
25
|
+
"email": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"title": "Email address"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": [
|
|
31
|
+
"kind",
|
|
32
|
+
"email"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"title": "Phone contact",
|
|
37
|
+
"properties": {
|
|
38
|
+
"kind": {
|
|
39
|
+
"const": "phone",
|
|
40
|
+
"default": "phone"
|
|
41
|
+
},
|
|
42
|
+
"phone": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"title": "Phone number",
|
|
45
|
+
"default": ""
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"required": [
|
|
49
|
+
"kind",
|
|
50
|
+
"phone"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"location": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"title": "Where to meet",
|
|
58
|
+
"anyOf": [
|
|
59
|
+
{
|
|
60
|
+
"title": "On site",
|
|
61
|
+
"properties": {
|
|
62
|
+
"room": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"title": "Room"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": [
|
|
68
|
+
"room"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"title": "Online",
|
|
73
|
+
"properties": {
|
|
74
|
+
"platform": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"title": "Platform"
|
|
77
|
+
},
|
|
78
|
+
"joinUrl": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"title": "Joining link"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"required": [
|
|
84
|
+
"platform"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"equipment": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"title": "Equipment",
|
|
92
|
+
"properties": {
|
|
93
|
+
"name": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"title": "Item"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"allOf": [
|
|
99
|
+
{
|
|
100
|
+
"title": "Identification",
|
|
101
|
+
"properties": {
|
|
102
|
+
"assetTag": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"title": "Asset tag",
|
|
105
|
+
"minLength": 6,
|
|
106
|
+
"maxLength": 6
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"title": "Condition",
|
|
112
|
+
"properties": {
|
|
113
|
+
"working": {
|
|
114
|
+
"type": "boolean",
|
|
115
|
+
"title": "In working order"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"attendees": {
|
|
122
|
+
"type": "integer",
|
|
123
|
+
"title": "Number of attendees",
|
|
124
|
+
"anyOf": [
|
|
125
|
+
{
|
|
126
|
+
"maximum": 12
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"minimum": 50
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"seatsPerTable": {
|
|
134
|
+
"type": "integer",
|
|
135
|
+
"title": "Seats per table",
|
|
136
|
+
"oneOf": [
|
|
137
|
+
{
|
|
138
|
+
"multipleOf": 3
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"multipleOf": 5
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
"urgent": {
|
|
146
|
+
"type": "boolean",
|
|
147
|
+
"title": "Urgent request"
|
|
148
|
+
},
|
|
149
|
+
"neededBy": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"title": "Needed by",
|
|
152
|
+
"minLength": 1
|
|
153
|
+
},
|
|
154
|
+
"appointment": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"title": "How to send the summary",
|
|
157
|
+
"properties": {
|
|
158
|
+
"method": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"title": "Method",
|
|
161
|
+
"enum": [
|
|
162
|
+
"collect",
|
|
163
|
+
"post",
|
|
164
|
+
"none"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"oneOf": [
|
|
169
|
+
{
|
|
170
|
+
"title": "Collect in person",
|
|
171
|
+
"properties": {
|
|
172
|
+
"method": {
|
|
173
|
+
"const": "collect"
|
|
174
|
+
},
|
|
175
|
+
"collectionPoint": {
|
|
176
|
+
"type": "string",
|
|
177
|
+
"title": "Collection point"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"required": [
|
|
181
|
+
"method"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"title": "By post",
|
|
186
|
+
"properties": {
|
|
187
|
+
"method": {
|
|
188
|
+
"const": "post"
|
|
189
|
+
},
|
|
190
|
+
"postcode": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"title": "Postcode"
|
|
193
|
+
},
|
|
194
|
+
"addressLine": {
|
|
195
|
+
"type": "string",
|
|
196
|
+
"title": "Address"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"required": [
|
|
200
|
+
"method"
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"title": "Do not send",
|
|
205
|
+
"properties": {
|
|
206
|
+
"method": {
|
|
207
|
+
"const": "none"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"required": [
|
|
211
|
+
"method"
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"if": {
|
|
218
|
+
"properties": {
|
|
219
|
+
"urgent": {
|
|
220
|
+
"const": true
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"required": [
|
|
224
|
+
"urgent"
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
"then": {
|
|
228
|
+
"required": [
|
|
229
|
+
"neededBy"
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
}
|