@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,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"coordinates.x.label": "Easting",
|
|
4
|
+
"coordinates.y.label": "Northing",
|
|
5
|
+
"tuple.position": "Item {position}",
|
|
6
|
+
"tuple.additionalItems": "Additional items",
|
|
7
|
+
"tuple.add": "Add item",
|
|
8
|
+
"tuple.delete": "Delete {label}",
|
|
9
|
+
"tuple.configuration": "This control asked for a tuple, but the schema does not describe one: give it positional schemas, or equal minItems and maxItems.",
|
|
10
|
+
"tuple.missingPosition": "Enter Item {position} first.",
|
|
11
|
+
"tuple.valueRequired": "Enter a value for this position.",
|
|
12
|
+
"tuple.initialType": "The additional item needs an explicit default or type.",
|
|
13
|
+
"tuple.forbidden": "No value is permitted at this position.",
|
|
14
|
+
"tuple.save": "Save changes",
|
|
15
|
+
"tuple.discard": "Discard changes",
|
|
16
|
+
"composite.summary.unset": "Not set",
|
|
17
|
+
"composite.summary.details": "View details",
|
|
18
|
+
"composite.summary.item": "{count} number",
|
|
19
|
+
"composite.summary.items": "{count} numbers",
|
|
20
|
+
"composite.summary.more": "(+{count} more)",
|
|
21
|
+
"composite.edit": "Edit {label}",
|
|
22
|
+
"composite.empty": "Clear",
|
|
23
|
+
"error.minimum": "Enter {limit} or more.",
|
|
24
|
+
"error.maxItems": "This record holds at most {limit} values.",
|
|
25
|
+
"featureNavigation.section1.label": "Positional editors",
|
|
26
|
+
"featureNavigation.section2.label": "Missing and trailing values",
|
|
27
|
+
"featureNavigation.section3.label": "Complex and invalid values",
|
|
28
|
+
"tupleExample.schema.properties.coordinates.label": "Drop-off coordinates",
|
|
29
|
+
"tupleExample.schema.properties.dimensions.label": "Crate dimensions in centimetres",
|
|
30
|
+
"tupleExample.schema.properties.survey.label": "Survey point",
|
|
31
|
+
"tupleExample.schema.properties.survey.description": "Its positions are placed by options.layout, not by the default row.",
|
|
32
|
+
"tupleExample.schema.properties.survey.items.0.label": "Latitude",
|
|
33
|
+
"tupleExample.schema.properties.survey.items.1.label": "Longitude",
|
|
34
|
+
"tupleExample.schema.properties.survey.items.2.label": "Elevation (m)",
|
|
35
|
+
"tupleExample.schema.properties.orderLine.label": "Order line",
|
|
36
|
+
"tupleExample.schema.properties.orderLine.items.0.label": "Product code",
|
|
37
|
+
"tupleExample.schema.properties.orderLine.items.1.label": "Quantity",
|
|
38
|
+
"tupleExample.schema.properties.inspection.label": "Inspection record",
|
|
39
|
+
"tupleExample.schema.properties.inspection.items.0.label": "Inspector",
|
|
40
|
+
"tupleExample.schema.properties.inspection.items.1.label": "Approved",
|
|
41
|
+
"tupleExample.schema.properties.inspection.additionalItems.label": "Note",
|
|
42
|
+
"tupleExample.schema.properties.flexible.label": "Supplier reference and free values",
|
|
43
|
+
"tupleExample.schema.properties.flexible.items.0.label": "Supplier",
|
|
44
|
+
"tupleExample.schema.properties.projectContact.label": "Project contact",
|
|
45
|
+
"tupleExample.schema.properties.projectContact.items.0.label": "Address",
|
|
46
|
+
"tupleExample.schema.properties.projectContact.items.0.properties.street.label": "Street",
|
|
47
|
+
"tupleExample.schema.properties.projectContact.items.0.properties.city.label": "City",
|
|
48
|
+
"tupleExample.schema.properties.projectContact.items.1.label": "Phone numbers",
|
|
49
|
+
"tupleExample.schema.properties.handoffContacts.label": "Handoff contacts",
|
|
50
|
+
"tupleExample.schema.properties.handoffContacts.description": "Four complex positions, each with a different registry entry.",
|
|
51
|
+
"tupleExample.schema.properties.handoffContacts.items.0.label": "Both",
|
|
52
|
+
"tupleExample.schema.properties.handoffContacts.items.0.properties.name.label": "Name",
|
|
53
|
+
"tupleExample.schema.properties.handoffContacts.items.0.properties.desk.label": "Desk",
|
|
54
|
+
"tupleExample.schema.properties.handoffContacts.items.1.label": "DetailOnly",
|
|
55
|
+
"tupleExample.schema.properties.handoffContacts.items.1.properties.name.label": "Name",
|
|
56
|
+
"tupleExample.schema.properties.handoffContacts.items.1.properties.desk.label": "Desk",
|
|
57
|
+
"tupleExample.schema.properties.handoffContacts.items.2.label": "LayoutEntry",
|
|
58
|
+
"tupleExample.schema.properties.handoffContacts.items.2.properties.name.label": "Name",
|
|
59
|
+
"tupleExample.schema.properties.handoffContacts.items.2.properties.desk.label": "Desk",
|
|
60
|
+
"tupleExample.schema.properties.handoffContacts.items.3.label": "NoEntry",
|
|
61
|
+
"tupleExample.schema.properties.handoffContacts.items.3.properties.name.label": "Name",
|
|
62
|
+
"tupleExample.schema.properties.handoffContacts.items.3.properties.desk.label": "Desk",
|
|
63
|
+
"tupleExample.schema.properties.legacyAssignment.label": "Imported assignment",
|
|
64
|
+
"tupleExample.schema.properties.legacyAssignment.items.0.label": "Leg code",
|
|
65
|
+
"tupleExample.schema.properties.legacyAssignment.items.1.label": "Sequence",
|
|
66
|
+
"tupleExample.schema.properties.misconfigured.label": "Asked for a tuple it cannot be",
|
|
67
|
+
"tupleExample.ui.elements.0.elements.0.elements.0.text": "Positional arrays. Each position is its own editor; the array is one value.",
|
|
68
|
+
"tupleExample.ui.elements.0.elements.0.elements.3.options.detail.elements.0.label": "Ground position",
|
|
69
|
+
"tupleExample.ui.elements.0.elements.1.elements.0.text": "Missing positions, and trailing values",
|
|
70
|
+
"tupleExample.ui.elements.0.elements.2.elements.0.text": "Complex positions, and values that do not fit"
|
|
71
|
+
},
|
|
72
|
+
"bg": {
|
|
73
|
+
"coordinates.x.label": "Източна координата",
|
|
74
|
+
"coordinates.y.label": "Северна координата",
|
|
75
|
+
"tuple.position": "Елемент {position}",
|
|
76
|
+
"tuple.additionalItems": "Допълнителни стойности",
|
|
77
|
+
"tuple.add": "Добавяне на стойност",
|
|
78
|
+
"tuple.delete": "Изтриване на {label}",
|
|
79
|
+
"tuple.configuration": "Контролата изисква кортеж, но схемата не описва такъв: задайте позиционни схеми или равни minItems и maxItems.",
|
|
80
|
+
"tuple.missingPosition": "Първо въведете Елемент {position}.",
|
|
81
|
+
"tuple.valueRequired": "Въведете стойност за тази позиция.",
|
|
82
|
+
"tuple.initialType": "Допълнителната стойност се нуждае от изрична стойност по подразбиране или тип.",
|
|
83
|
+
"tuple.forbidden": "На тази позиция не се допуска стойност.",
|
|
84
|
+
"tuple.save": "Запазване на промените",
|
|
85
|
+
"tuple.discard": "Отказ от промените",
|
|
86
|
+
"composite.summary.unset": "Не е зададено",
|
|
87
|
+
"composite.summary.details": "Преглед на детайлите",
|
|
88
|
+
"composite.summary.item": "{count} номер",
|
|
89
|
+
"composite.summary.items": "{count} номера",
|
|
90
|
+
"composite.summary.more": "(+{count} още)",
|
|
91
|
+
"composite.edit": "Редактиране на {label}",
|
|
92
|
+
"composite.empty": "Изчистване",
|
|
93
|
+
"error.minimum": "Въведете {limit} или повече.",
|
|
94
|
+
"error.maxItems": "Този запис съдържа най-много {limit} стойности.",
|
|
95
|
+
"featureNavigation.section1.label": "Позиционни редактори",
|
|
96
|
+
"featureNavigation.section2.label": "Липсващи и допълнителни стойности",
|
|
97
|
+
"featureNavigation.section3.label": "Сложни и невалидни стойности",
|
|
98
|
+
"tupleExample.schema.properties.coordinates.label": "Координати за доставка",
|
|
99
|
+
"tupleExample.schema.properties.dimensions.label": "Размери на касата в сантиметри",
|
|
100
|
+
"tupleExample.schema.properties.survey.label": "Геодезическа точка",
|
|
101
|
+
"tupleExample.schema.properties.survey.description": "Позициите са подредени чрез options.layout, а не в стандартния ред.",
|
|
102
|
+
"tupleExample.schema.properties.survey.items.0.label": "Географска ширина",
|
|
103
|
+
"tupleExample.schema.properties.survey.items.1.label": "Географска дължина",
|
|
104
|
+
"tupleExample.schema.properties.survey.items.2.label": "Надморска височина (м)",
|
|
105
|
+
"tupleExample.schema.properties.orderLine.label": "Ред от поръчката",
|
|
106
|
+
"tupleExample.schema.properties.orderLine.items.0.label": "Код на продукта",
|
|
107
|
+
"tupleExample.schema.properties.orderLine.items.1.label": "Количество",
|
|
108
|
+
"tupleExample.schema.properties.inspection.label": "Протокол от проверката",
|
|
109
|
+
"tupleExample.schema.properties.inspection.items.0.label": "Проверяващ",
|
|
110
|
+
"tupleExample.schema.properties.inspection.items.1.label": "Одобрено",
|
|
111
|
+
"tupleExample.schema.properties.inspection.additionalItems.label": "Бележка",
|
|
112
|
+
"tupleExample.schema.properties.flexible.label": "Доставчик и свободни стойности",
|
|
113
|
+
"tupleExample.schema.properties.flexible.items.0.label": "Доставчик",
|
|
114
|
+
"tupleExample.schema.properties.projectContact.label": "Контакт по проекта",
|
|
115
|
+
"tupleExample.schema.properties.projectContact.items.0.label": "Адрес",
|
|
116
|
+
"tupleExample.schema.properties.projectContact.items.0.properties.street.label": "Улица",
|
|
117
|
+
"tupleExample.schema.properties.projectContact.items.0.properties.city.label": "Град",
|
|
118
|
+
"tupleExample.schema.properties.projectContact.items.1.label": "Телефонни номера",
|
|
119
|
+
"tupleExample.schema.properties.handoffContacts.label": "Контакти при предаване",
|
|
120
|
+
"tupleExample.schema.properties.handoffContacts.description": "Четири съставни позиции, всяка с различна регистрирана схема на интерфейса.",
|
|
121
|
+
"tupleExample.schema.properties.handoffContacts.items.0.label": "Обобщение и детайли",
|
|
122
|
+
"tupleExample.schema.properties.handoffContacts.items.0.properties.name.label": "Име",
|
|
123
|
+
"tupleExample.schema.properties.handoffContacts.items.0.properties.desk.label": "Отдел",
|
|
124
|
+
"tupleExample.schema.properties.handoffContacts.items.1.label": "Само детайли",
|
|
125
|
+
"tupleExample.schema.properties.handoffContacts.items.1.properties.name.label": "Име",
|
|
126
|
+
"tupleExample.schema.properties.handoffContacts.items.1.properties.desk.label": "Отдел",
|
|
127
|
+
"tupleExample.schema.properties.handoffContacts.items.2.label": "Регистрирано оформление",
|
|
128
|
+
"tupleExample.schema.properties.handoffContacts.items.2.properties.name.label": "Име",
|
|
129
|
+
"tupleExample.schema.properties.handoffContacts.items.2.properties.desk.label": "Отдел",
|
|
130
|
+
"tupleExample.schema.properties.handoffContacts.items.3.label": "Без регистрирано оформление",
|
|
131
|
+
"tupleExample.schema.properties.handoffContacts.items.3.properties.name.label": "Име",
|
|
132
|
+
"tupleExample.schema.properties.handoffContacts.items.3.properties.desk.label": "Отдел",
|
|
133
|
+
"tupleExample.schema.properties.legacyAssignment.label": "Импортирано назначение",
|
|
134
|
+
"tupleExample.schema.properties.legacyAssignment.items.0.label": "Код на етапа",
|
|
135
|
+
"tupleExample.schema.properties.legacyAssignment.items.1.label": "Пореден номер",
|
|
136
|
+
"tupleExample.schema.properties.misconfigured.label": "Неподходяща схема за кортеж",
|
|
137
|
+
"tupleExample.ui.elements.0.elements.0.elements.0.text": "Позиционни масиви. Всяка позиция има собствен редактор, а масивът е една стойност.",
|
|
138
|
+
"tupleExample.ui.elements.0.elements.0.elements.3.options.detail.elements.0.label": "Наземна позиция",
|
|
139
|
+
"tupleExample.ui.elements.0.elements.1.elements.0.text": "Липсващи позиции и допълнителни стойности",
|
|
140
|
+
"tupleExample.ui.elements.0.elements.2.elements.0.text": "Съставни позиции и несъответстващи стойности"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "VerticalLayout",
|
|
3
|
+
"elements": [
|
|
4
|
+
{
|
|
5
|
+
"type": "Categorization",
|
|
6
|
+
"elements": [
|
|
7
|
+
{
|
|
8
|
+
"type": "Category",
|
|
9
|
+
"label": "Positional editors",
|
|
10
|
+
"i18n": "featureNavigation.section1",
|
|
11
|
+
"elements": [
|
|
12
|
+
{
|
|
13
|
+
"type": "Label",
|
|
14
|
+
"text": "Positional arrays. Each position is its own editor; the array is one value."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "Control",
|
|
18
|
+
"scope": "#/properties/coordinates",
|
|
19
|
+
"options": {
|
|
20
|
+
"showBorder": false
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "Control",
|
|
25
|
+
"scope": "#/properties/dimensions",
|
|
26
|
+
"options": {
|
|
27
|
+
"variant": "tuple",
|
|
28
|
+
"vertical": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "Control",
|
|
33
|
+
"scope": "#/properties/survey",
|
|
34
|
+
"options": {
|
|
35
|
+
"detail": {
|
|
36
|
+
"type": "VerticalLayout",
|
|
37
|
+
"elements": [
|
|
38
|
+
{
|
|
39
|
+
"type": "Group",
|
|
40
|
+
"label": "Ground position",
|
|
41
|
+
"elements": [
|
|
42
|
+
{
|
|
43
|
+
"type": "HorizontalLayout",
|
|
44
|
+
"elements": [
|
|
45
|
+
{
|
|
46
|
+
"type": "Control",
|
|
47
|
+
"scope": "#/items/1"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"type": "Control",
|
|
51
|
+
"scope": "#/items/0"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"type": "Control",
|
|
59
|
+
"scope": "#/items/2"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"type": "Category",
|
|
69
|
+
"label": "Missing and trailing values",
|
|
70
|
+
"i18n": "featureNavigation.section2",
|
|
71
|
+
"elements": [
|
|
72
|
+
{
|
|
73
|
+
"type": "Label",
|
|
74
|
+
"text": "Missing positions, and trailing values"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"type": "Control",
|
|
78
|
+
"scope": "#/properties/orderLine"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"type": "Control",
|
|
82
|
+
"scope": "#/properties/inspection"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"type": "Control",
|
|
86
|
+
"scope": "#/properties/flexible"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "Category",
|
|
92
|
+
"label": "Complex and invalid values",
|
|
93
|
+
"i18n": "featureNavigation.section3",
|
|
94
|
+
"elements": [
|
|
95
|
+
{
|
|
96
|
+
"type": "Label",
|
|
97
|
+
"text": "Complex positions, and values that do not fit"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"type": "Control",
|
|
101
|
+
"scope": "#/properties/projectContact",
|
|
102
|
+
"options": {
|
|
103
|
+
"showEmptyButton": true,
|
|
104
|
+
"okLabel": "tuple.save",
|
|
105
|
+
"cancelLabel": "tuple.discard"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"type": "Control",
|
|
110
|
+
"scope": "#/properties/handoffContacts"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "Control",
|
|
114
|
+
"scope": "#/properties/legacyAssignment"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"type": "Control",
|
|
118
|
+
"scope": "#/properties/misconfigured",
|
|
119
|
+
"options": {
|
|
120
|
+
"variant": "tuple"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"match": {
|
|
4
|
+
"rank": 10,
|
|
5
|
+
"schemaPointer": "/title",
|
|
6
|
+
"equals": "Both"
|
|
7
|
+
},
|
|
8
|
+
"uischema": {
|
|
9
|
+
"type": "Control",
|
|
10
|
+
"scope": "#",
|
|
11
|
+
"options": {
|
|
12
|
+
"summary": {
|
|
13
|
+
"type": "Control",
|
|
14
|
+
"scope": "#/properties/name"
|
|
15
|
+
},
|
|
16
|
+
"detail": {
|
|
17
|
+
"type": "VerticalLayout",
|
|
18
|
+
"elements": [
|
|
19
|
+
{
|
|
20
|
+
"type": "Control",
|
|
21
|
+
"scope": "#/properties/desk"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "Control",
|
|
25
|
+
"scope": "#/properties/name"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"match": {
|
|
34
|
+
"rank": 10,
|
|
35
|
+
"schemaPointer": "/title",
|
|
36
|
+
"equals": "DetailOnly"
|
|
37
|
+
},
|
|
38
|
+
"uischema": {
|
|
39
|
+
"type": "Control",
|
|
40
|
+
"scope": "#",
|
|
41
|
+
"options": {
|
|
42
|
+
"detail": {
|
|
43
|
+
"type": "VerticalLayout",
|
|
44
|
+
"elements": [
|
|
45
|
+
{
|
|
46
|
+
"type": "Control",
|
|
47
|
+
"scope": "#/properties/desk"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"match": {
|
|
56
|
+
"rank": 10,
|
|
57
|
+
"schemaPointer": "/title",
|
|
58
|
+
"equals": "LayoutEntry"
|
|
59
|
+
},
|
|
60
|
+
"uischema": {
|
|
61
|
+
"type": "HorizontalLayout",
|
|
62
|
+
"elements": [
|
|
63
|
+
{
|
|
64
|
+
"type": "Control",
|
|
65
|
+
"scope": "#/properties/name"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"type": "Control",
|
|
69
|
+
"scope": "#/properties/desk"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"match": {
|
|
76
|
+
"rank": 10,
|
|
77
|
+
"schemaPointer": "/title",
|
|
78
|
+
"equals": "Address"
|
|
79
|
+
},
|
|
80
|
+
"uischema": {
|
|
81
|
+
"type": "Control",
|
|
82
|
+
"scope": "#",
|
|
83
|
+
"options": {
|
|
84
|
+
"summary": {
|
|
85
|
+
"type": "Control",
|
|
86
|
+
"scope": "#/properties/street"
|
|
87
|
+
},
|
|
88
|
+
"detail": {
|
|
89
|
+
"type": "VerticalLayout",
|
|
90
|
+
"elements": [
|
|
91
|
+
{
|
|
92
|
+
"type": "Control",
|
|
93
|
+
"scope": "#/properties/street"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"type": "Control",
|
|
97
|
+
"scope": "#/properties/city"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"match": {
|
|
106
|
+
"rank": 10,
|
|
107
|
+
"schemaPointer": "/title",
|
|
108
|
+
"equals": "Phone numbers"
|
|
109
|
+
},
|
|
110
|
+
"uischema": {
|
|
111
|
+
"type": "Control",
|
|
112
|
+
"scope": "#",
|
|
113
|
+
"options": {
|
|
114
|
+
"summary": {
|
|
115
|
+
"type": "Control",
|
|
116
|
+
"scope": "#"
|
|
117
|
+
},
|
|
118
|
+
"detail": {
|
|
119
|
+
"type": "Control",
|
|
120
|
+
"scope": "#"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
]
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Example: validator profile (Ajv)
|
|
2
|
+
|
|
3
|
+
**Example ID:** `validator-profile`\
|
|
4
|
+
**Demo entry:** **Spec: Validator profile (Ajv)** (`#spec-validator-profile`)\
|
|
5
|
+
**Domain:** course enrolment\
|
|
6
|
+
**Specs covered:**
|
|
7
|
+
|
|
8
|
+
- [Extended validator profile](../../docs/spec.md#159-data-schemas-rules-and-validator-profile)
|
|
9
|
+
- [Internationalizable text](../../docs/spec.md#159-data-schemas-rules-and-validator-profile)
|
|
10
|
+
- [script-evaluation permission](../../docs/spec.md#159-data-schemas-rules-and-validator-profile)
|
|
11
|
+
- [The extended validator profile](../../docs/spec.md#159-data-schemas-rules-and-validator-profile)
|
|
12
|
+
|
|
13
|
+
**Nothing in this example is renderer behaviour.** Every tab is something the
|
|
14
|
+
validator did before a renderer saw anything: reported a failure, rewrote a
|
|
15
|
+
value, filled a field in, or said it in another language. The UI schema is four
|
|
16
|
+
tabs of plain `Control`s on purpose.
|
|
17
|
+
|
|
18
|
+
| Tab | What the validator is doing |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| **Errors** | Ordinary keyword failures, worded by Ajv and localized by `ajv-i18n` |
|
|
21
|
+
| **transform** | Rewriting the stored value as a side effect of validating |
|
|
22
|
+
| **Defaults** | Filling fields in: static, computed, from the page address, and from a function in the schema |
|
|
23
|
+
| **Messages in the schema** | `errorMessage`, so the schema says it rather than the validator |
|
|
24
|
+
|
|
25
|
+
## Files
|
|
26
|
+
|
|
27
|
+
| File | Role |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `schema.json` | Everything the profile adds, in one schema. |
|
|
30
|
+
| `uischema.json` | Four tabs of plain Controls — deliberately dull. |
|
|
31
|
+
| `data.json` | Pre-filled with failures and with untidy values to normalise. |
|
|
32
|
+
| `config.json` | `allowScriptEvaluation: true`, needed by exactly one field. |
|
|
33
|
+
| `translations.json` | The tab text, and the schema's own messages. **No error text.** |
|
|
34
|
+
|
|
35
|
+
## Errors: the wording is the validator's
|
|
36
|
+
|
|
37
|
+
`must NOT be shorter than 3 characters` is Ajv's sentence, not ours. Switch the
|
|
38
|
+
form to Bulgarian and it changes — and the interesting part is what is **not**
|
|
39
|
+
in `translations.json`:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
error.minLength ← absent
|
|
43
|
+
error.minimum ← absent
|
|
44
|
+
error.format ← absent
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
There is no validator error text in the catalog at all, in either language, and
|
|
48
|
+
a test fails if anyone adds some. The Bulgarian comes from `ajv-i18n`, wired in
|
|
49
|
+
through `createFormsAjv`. That is the distinction this tab exists to draw:
|
|
50
|
+
**JSON Forms' own `error.*` keys are a different mechanism**, and this form uses
|
|
51
|
+
none of them.
|
|
52
|
+
|
|
53
|
+
Bulgarian is carried by this repository rather than by `ajv-i18n`, which does
|
|
54
|
+
not ship it.
|
|
55
|
+
|
|
56
|
+
### Localized *when*, and why it matters
|
|
57
|
+
|
|
58
|
+
Ajv's messages can be localized at two moments, and only one of them survives a
|
|
59
|
+
language switch:
|
|
60
|
+
|
|
61
|
+
| | Produced | On a locale change |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| `createFormsAjv({ localizers })` | at **validation** | stays in the old language until something revalidates |
|
|
64
|
+
| `i18n.translateError` | at **render** | changes immediately |
|
|
65
|
+
|
|
66
|
+
JSON Forms does **not** revalidate when the locale changes. This example uses
|
|
67
|
+
the render-time hook, which is why the switch is visible with the data
|
|
68
|
+
untouched. A host using validation-time localization must revalidate when the
|
|
69
|
+
locale changes.
|
|
70
|
+
|
|
71
|
+
## transform: validation that edits the data
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{ "type": "string", "transform": ["trim", "startCase"] }
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Type an untidy value and blur: the **stored data** changes, not just the
|
|
78
|
+
display. That is unusual for a validator and worth saying out loud.
|
|
79
|
+
|
|
80
|
+
| Field | Transformations | `" ab-12 "` becomes |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| Code | `trim`, `toUpperCase` | `AB-12` |
|
|
83
|
+
| Town | `trim`, `startCase` | `North Harbour` |
|
|
84
|
+
| Note | `trim`, `capitalize` | `Please seat us together` |
|
|
85
|
+
| Level | `trim`, `toEnumCase` | `Intermediate` — matched to a declared choice |
|
|
86
|
+
|
|
87
|
+
`capitalize` and `startCase` are **not** in `ajv-keywords`. Its transformation
|
|
88
|
+
table is a module constant with no registration hook, so this project replaces
|
|
89
|
+
the keyword rather than extending it.
|
|
90
|
+
|
|
91
|
+
`toEnumCase` needs an `enum` in the same schema and matches case-insensitively:
|
|
92
|
+
`intermediate` becomes the declared `Intermediate` rather than being left as a
|
|
93
|
+
value that then fails `enum`.
|
|
94
|
+
|
|
95
|
+
## Defaults
|
|
96
|
+
|
|
97
|
+
Three kinds, and the difference between them is when the value is decided.
|
|
98
|
+
|
|
99
|
+
**A plain `default`** is written into the data on first validation — including
|
|
100
|
+
`false`, which is why *Confirmed* arrives unticked rather than absent. A
|
|
101
|
+
truthiness check loses that case.
|
|
102
|
+
|
|
103
|
+
**`dynamicDefaults`** computes one:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
"dynamicDefaults": {
|
|
107
|
+
"opensOn": { "func": "date", "args": {} },
|
|
108
|
+
"closesOn": { "func": "date", "args": { "duration": "P14D" } },
|
|
109
|
+
"year": { "func": "dateUnit", "args": { "unit": "year" } }
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The offset is an ISO 8601 duration, and `op: "subtract"` goes the other way.
|
|
114
|
+
These replace `ajv-keywords`' own `date`/`time`/`datetime`, which take no
|
|
115
|
+
arguments; with no arguments they behave identically.
|
|
116
|
+
|
|
117
|
+
### An object field holding the current request parameters
|
|
118
|
+
|
|
119
|
+
This is what `searchParams` is for:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
"request": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"default": {},
|
|
125
|
+
"properties": { "ref": {…}, "campaign": {…}, "source": {…} },
|
|
126
|
+
"dynamicDefaults": {
|
|
127
|
+
"ref": { "func": "searchParams", "args": { "param": "ref" } },
|
|
128
|
+
"campaign": { "func": "searchParams", "args": { "param": "campaign" } },
|
|
129
|
+
"source": { "func": "searchParams", "args": { "param": "source" } }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Open the demo with `?ref=AB-1234&campaign=spring` and the object arrives
|
|
135
|
+
holding them. **The hash query is read too** — `#/form?source=email` — because
|
|
136
|
+
that is where a hash-routed application puts its parameters, and an enrolment
|
|
137
|
+
link is exactly the case this exists for.
|
|
138
|
+
|
|
139
|
+
`"default": {}` on the object is what makes the nested defaults reachable: the
|
|
140
|
+
generators fill properties of an object that has to exist first.
|
|
141
|
+
|
|
142
|
+
A parameter that is not present yields nothing rather than an empty string, so
|
|
143
|
+
the field stays absent and any `required` on it still fails honestly.
|
|
144
|
+
|
|
145
|
+
### A default computed by a function in the schema
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{ "func": "dynamic", "args": { "who": "student", "func": "(args) => `Welcome, ${args.who}.`" } }
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**This one needs permission.** `config.json` grants
|
|
152
|
+
`jsonformsExtended.security.allowScriptEvaluation`, and without it the field
|
|
153
|
+
stays empty and the console says why. A schema is data — it can arrive with the
|
|
154
|
+
form — so compiling a string out of it is the same capability the template
|
|
155
|
+
engines and `Button.script` are gated on.
|
|
156
|
+
|
|
157
|
+
## Messages in the schema
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
"errorMessage": {
|
|
161
|
+
"required": { "nickname": "nicknameRequired" },
|
|
162
|
+
"properties": { "nickname": "nicknameTooShort", "postcode": "A postcode is four digits, like 1010." }
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
A message is looked up as **`error.errorMessage.<message>`** first and used
|
|
167
|
+
literally if that resolves to nothing — so *Nickname* and *Age* translate, and
|
|
168
|
+
*Postcode* is a sentence that stays as written in both languages. That is the
|
|
169
|
+
same key-or-text rule this renderer set applies to labels.
|
|
170
|
+
|
|
171
|
+
**Each message appears under its own field**, which is the part that is easy to
|
|
172
|
+
lose: `ajv-errors` replaces the failures it covers with a *single* error at the
|
|
173
|
+
enclosing object's path, and JSON Forms maps errors to controls **by path**.
|
|
174
|
+
Left alone, a schema that adds friendly messages makes every field it covers go
|
|
175
|
+
silent. See [the specification](../../docs/spec.md#159-data-schemas-rules-and-validator-profile).
|
|
176
|
+
|
|
177
|
+
## Expected behaviour
|
|
178
|
+
|
|
179
|
+
| Action | Result |
|
|
180
|
+
| --- | --- |
|
|
181
|
+
| Open **Errors** | Four failures, worded by the validator. |
|
|
182
|
+
| Switch to Bulgarian | The wording changes, with no error key in the catalog. |
|
|
183
|
+
| Open **transform** | The untidy values are already normalised in the data panel. |
|
|
184
|
+
| Open **Defaults** | Currency `EUR`, Confirmed unticked, dates filled in. |
|
|
185
|
+
| Reload with `?ref=AB-1234` | The request object carries it. |
|
|
186
|
+
| Remove `allowScriptEvaluation` | *Greeting* is empty; the console names the permission. |
|
|
187
|
+
| Open **Messages in the schema** | Each message under its own field. |
|
|
188
|
+
| Switch to Bulgarian there | The two keyed messages follow; the Postcode sentence does not. |
|
|
189
|
+
|
|
190
|
+
## Conformance scope
|
|
191
|
+
|
|
192
|
+
This walkthrough describes the portable contract. Renderer support must be checked
|
|
193
|
+
by a host adapter; the package validates the authored assets, not live UI behavior.
|
|
194
|
+
|
|
195
|
+
## Standalone host setup
|
|
196
|
+
|
|
197
|
+
- Install the extended validator profile in spec.md; plain JSON Schema validation does not implement transforms, dynamic defaults or custom error messages.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fullName": "Jo",
|
|
3
|
+
"email": "not-an-address",
|
|
4
|
+
"seats": 9,
|
|
5
|
+
"reference": "xx-1",
|
|
6
|
+
"tidy": {
|
|
7
|
+
"code": " ab-12 ",
|
|
8
|
+
"town": " north harbour ",
|
|
9
|
+
"note": " please seat us together ",
|
|
10
|
+
"level": " intermediate "
|
|
11
|
+
},
|
|
12
|
+
"spoken": {
|
|
13
|
+
"age": 12,
|
|
14
|
+
"postcode": "12"
|
|
15
|
+
}
|
|
16
|
+
}
|