@defra/forms-model 3.0.431 → 3.0.433
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/dist/module/form/form-definition/index.js +2 -1
- package/dist/module/form/form-definition/index.js.map +1 -1
- package/dist/module/form/form-definition/types.js.map +1 -1
- package/dist/module/form/form-editor/index.js +107 -0
- package/dist/module/form/form-editor/index.js.map +1 -1
- package/dist/module/form/form-editor/types.js.map +1 -1
- package/dist/module/form/form-manager/index.js +1 -1
- package/dist/module/form/form-manager/index.js.map +1 -1
- package/dist/types/form/form-definition/index.d.ts.map +1 -1
- package/dist/types/form/form-definition/types.d.ts +1 -0
- package/dist/types/form/form-definition/types.d.ts.map +1 -1
- package/dist/types/form/form-editor/index.d.ts +21 -1
- package/dist/types/form/form-editor/index.d.ts.map +1 -1
- package/dist/types/form/form-editor/types.d.ts +8 -2
- package/dist/types/form/form-editor/types.d.ts.map +1 -1
- package/dist/types/form/form-manager/index.d.ts +1 -1
- package/dist/types/form/form-manager/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/component-schema-v2.json +162 -0
- package/schemas/component-schema.json +162 -0
- package/schemas/date-sub-schema.json +11 -0
- package/schemas/form-definition-schema.json +1886 -0
- package/schemas/form-definition-v2-payload-schema.json +1469 -0
- package/schemas/form-editor-input-check-answers-setting-schema.json +18 -0
- package/schemas/form-editor-input-page-schema.json +41 -0
- package/schemas/form-editor-input-page-settings-schema.json +28 -0
- package/schemas/form-editor-input-question-schema.json +38 -0
- package/schemas/form-metadata-author-schema.json +24 -0
- package/schemas/form-metadata-contact-schema.json +61 -0
- package/schemas/form-metadata-email-schema.json +25 -0
- package/schemas/form-metadata-input-schema.json +127 -0
- package/schemas/form-metadata-online-schema.json +25 -0
- package/schemas/form-metadata-schema.json +340 -0
- package/schemas/form-metadata-state-schema.json +72 -0
- package/schemas/form-submit-payload-schema.json +124 -0
- package/schemas/form-submit-record-schema.json +30 -0
- package/schemas/form-submit-recordset-schema.json +62 -0
- package/schemas/list-schema-v2.json +496 -0
- package/schemas/list-schema.json +496 -0
- package/schemas/max-future-schema.json +8 -0
- package/schemas/max-length-schema.json +8 -0
- package/schemas/max-past-schema.json +8 -0
- package/schemas/max-schema.json +7 -0
- package/schemas/min-length-schema.json +8 -0
- package/schemas/min-schema.json +7 -0
- package/schemas/page-schema-payload-v2.json +400 -0
- package/schemas/page-schema-v2.json +400 -0
- package/schemas/page-schema.json +400 -0
- package/schemas/page-type-schema.json +11 -0
- package/schemas/pagination-options-schema.json +27 -0
- package/schemas/patch-page-schema.json +26 -0
- package/schemas/query-options-schema.json +94 -0
- package/schemas/question-schema.json +7 -0
- package/schemas/question-type-full-schema.json +22 -0
- package/schemas/question-type-schema.json +20 -0
- package/schemas/search-options-schema.json +59 -0
- package/schemas/sorting-options-schema.json +28 -0
- package/schemas/written-answer-sub-schema.json +12 -0
- package/src/form/form-definition/index.ts +5 -1
- package/src/form/form-definition/types.ts +1 -0
- package/src/form/form-editor/index.ts +147 -1
- package/src/form/form-editor/types.ts +19 -2
- package/src/form/form-manager/index.ts +1 -1
- package/scripts/generate-schemas.js +0 -238
- package/scripts/schema-modules/constants.js +0 -39
- package/scripts/schema-modules/schema-processors.js +0 -109
- package/scripts/schema-modules/schema-simplifiers.js +0 -351
- package/scripts/schema-modules/title-processors.js +0 -327
- package/scripts/schema-modules/types.js +0 -21
- package/scripts/schema-modules/utils.js +0 -41
@@ -1,4 +1,4 @@
|
|
1
|
-
import Joi from 'joi';
|
1
|
+
import Joi, { type ArraySchema } from 'joi';
|
2
2
|
import { type FormEditorInputCheckAnswersSettings, type FormEditorInputPage, type FormEditorInputPageSettings, type FormEditorInputQuestion } from '../../form/form-editor/types.js';
|
3
3
|
export declare enum QuestionTypeSubGroup {
|
4
4
|
WrittenAnswerSubGroup = "writtenAnswerSub",
|
@@ -45,7 +45,26 @@ export declare const regexSchema: Joi.StringSchema<string>;
|
|
45
45
|
export declare const rowsSchema: Joi.NumberSchema<number>;
|
46
46
|
export declare const suffixSchema: Joi.StringSchema<string>;
|
47
47
|
export declare const classesSchema: Joi.StringSchema<string>;
|
48
|
+
interface DSLSchema<TSchema = Record<string, unknown>[]> extends ArraySchema<TSchema> {
|
49
|
+
rowSeparator: (rowSep: string | RegExp) => DSLSchema<TSchema>;
|
50
|
+
row: (rowSep: string | RegExp) => DSLSchema<TSchema>;
|
51
|
+
colSeparator: (colSep: string | RegExp) => DSLSchema<TSchema>;
|
52
|
+
col: (colSep: string | RegExp) => DSLSchema<TSchema>;
|
53
|
+
keys: (keys: string[]) => DSLSchema<TSchema>;
|
54
|
+
}
|
55
|
+
interface CustomValidator extends Joi.Root {
|
56
|
+
dsv<TSchema>(): DSLSchema<TSchema>;
|
57
|
+
}
|
58
|
+
export declare const customValidator: CustomValidator;
|
59
|
+
export declare const autoCompleteOptionsSchema: DSLSchema<{
|
60
|
+
text: string;
|
61
|
+
value: string;
|
62
|
+
}>;
|
48
63
|
export declare const questionDetailsFullSchema: {
|
64
|
+
autoCompleteOptionsSchema: DSLSchema<{
|
65
|
+
text: string;
|
66
|
+
value: string;
|
67
|
+
}>;
|
49
68
|
classesSchema: Joi.StringSchema<string>;
|
50
69
|
documentTypesSchema: Joi.ArraySchema<any[]>;
|
51
70
|
enhancedActionSchema: Joi.StringSchema<string>;
|
@@ -115,4 +134,5 @@ export declare const formEditorInputPageSettingsKeys: {
|
|
115
134
|
* @see {@link FormEditorInputPageSettings}
|
116
135
|
*/
|
117
136
|
export declare const formEditorInputPageSettingsSchema: Joi.ObjectSchema<FormEditorInputPageSettings>;
|
137
|
+
export {};
|
118
138
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/index.ts"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C;AAED,UAAU,eAAgB,SAAQ,GAAG,CAAC,IAAI;IACxC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,CAAC,CAAA;CACnC;AAED,eAAO,MAAM,eAAe,EA4GtB,eAAe,CAAA;AAErB,eAAO,MAAM,yBAAyB;UACvB,MAAM;WAAS,MAAM;EAevB,CAAA;AAEb,eAAO,MAAM,yBAAyB;;cAjBvB,MAAM;eAAS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDnC,CAAA;AAED,eAAO,MAAM,uBAAuB;;;CAGnC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,uCAGmC,CAAA;AAEzE,eAAO,MAAM,sCAAsC;;CAElD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,wCAAwC,uDAIO,CAAA;AAE5D,eAAO,MAAM,2BAA2B;;;;;CAKvC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,2CAMrC,CAAA;AAEL,eAAO,MAAM,+BAA+B;;;;CAI3C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,+CAI8B,CAAA"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { type ComponentDef } from '../../components/types.js';
|
2
|
+
import { type Item } from '../../index.js';
|
2
3
|
/**
|
3
4
|
* Interface for `FormEditor` Joi schema
|
4
5
|
*/
|
@@ -163,10 +164,11 @@ export interface FormEditor {
|
|
163
164
|
* The value of the radio item
|
164
165
|
*/
|
165
166
|
radioValue: string;
|
167
|
+
autoCompleteOptions: Item[];
|
166
168
|
}
|
167
169
|
export type FormEditorInputPage = Pick<FormEditor, 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'>;
|
168
170
|
export type FormEditorInputCheckAnswersSettings = Pick<FormEditor, 'needDeclaration' | 'declarationText'>;
|
169
|
-
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'name' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'rows' | 'classes' | 'prefix' | 'suffix' | 'precision' | 'min' | 'max' | 'maxFuture' | 'maxPast' | 'exactFiles' | 'minFiles' | 'maxFiles' | 'fileTypes' | 'documentTypes' | 'imageTypes' | 'tabularDataTypes' | 'enhancedAction' | 'radioId' | 'radioLabel' | 'radioHint' | 'radioValue'>;
|
171
|
+
export type FormEditorInputQuestion = Pick<FormEditor, 'questionType' | 'name' | 'question' | 'shortDescription' | 'hintText' | 'questionOptional' | 'minLength' | 'maxLength' | 'regex' | 'rows' | 'classes' | 'prefix' | 'suffix' | 'precision' | 'min' | 'max' | 'maxFuture' | 'maxPast' | 'exactFiles' | 'minFiles' | 'maxFiles' | 'fileTypes' | 'documentTypes' | 'imageTypes' | 'tabularDataTypes' | 'autoCompleteOptions' | 'enhancedAction' | 'radioId' | 'radioLabel' | 'radioHint' | 'radioValue'>;
|
170
172
|
export type FormEditorInputPageSettings = Pick<FormEditor, 'pageHeadingAndGuidance' | 'pageHeading' | 'guidanceText'>;
|
171
173
|
export type FormEditorInputGuidancePage = Pick<FormEditor, 'pageHeading' | 'guidanceText'>;
|
172
174
|
export type FormEditorInputQuestionDetails = Pick<FormEditorInputQuestion, 'question' | 'hintText' | 'shortDescription' | 'questionOptional' | 'questionType' | 'fileTypes' | 'documentTypes' | 'imageTypes' | 'tabularDataTypes' | 'enhancedAction' | 'radioId' | 'radioLabel' | 'radioHint' | 'radioValue'>;
|
@@ -197,12 +199,13 @@ export interface GovukField {
|
|
197
199
|
classes?: string;
|
198
200
|
};
|
199
201
|
};
|
200
|
-
value?: string | boolean | number | string[];
|
202
|
+
value?: string | boolean | number | string[] | Item[];
|
201
203
|
classes?: string;
|
202
204
|
label?: {
|
203
205
|
text?: string;
|
204
206
|
html?: string;
|
205
207
|
classes?: string;
|
208
|
+
isPageHeading?: boolean;
|
206
209
|
};
|
207
210
|
hint?: {
|
208
211
|
text?: string;
|
@@ -228,10 +231,13 @@ export interface FormEditorGovukField {
|
|
228
231
|
imageTypes?: GovukField;
|
229
232
|
tabularDataTypes?: GovukField;
|
230
233
|
radiosOrCheckboxes?: GovukField;
|
234
|
+
autoCompleteOptions?: GovukField;
|
231
235
|
errorMessage?: {
|
232
236
|
text: string;
|
233
237
|
};
|
234
238
|
}
|
239
|
+
export type FormEditorGovukFieldBase = Omit<FormEditorGovukField, 'errorMessage'>;
|
240
|
+
export type FormEditorGovukFieldBaseKeys = keyof FormEditorGovukFieldBase;
|
235
241
|
export interface FormEditorCheckbox {
|
236
242
|
text?: string;
|
237
243
|
hint?: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/form/form-editor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAEhC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IAExB;;OAEG;IACH,sBAAsB,EAAE,MAA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E,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,gBAAgB,CAAC,EAAE,UAAU,CAAA;IAC7B,kBAAkB,CAAC,EAAE,UAAU,CAAA;IAC/B,mBAAmB,CAAC,EAAE,UAAU,CAAA;IAChC,YAAY,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAChC;AAED,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,oBAAoB,EACpB,cAAc,CACf,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,MAAM,wBAAwB,CAAA;AAEzE,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACF"}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import Joi from 'joi';
|
2
|
-
export declare const patchPageSchema: Joi.ObjectSchema<Partial<Pick<import("
|
2
|
+
export declare const patchPageSchema: Joi.ObjectSchema<Partial<Pick<import("../form-definition/types.js").Page, "title" | "path" | "controller">>>;
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAKrB,eAAO,MAAM,eAAe,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/form/form-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AAKrB,eAAO,MAAM,eAAe,8GAezB,CAAA"}
|
package/package.json
CHANGED
@@ -0,0 +1,162 @@
|
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"description": "Enhanced component schema for V2 forms with auto-generated IDs",
|
4
|
+
"properties": {
|
5
|
+
"type": {
|
6
|
+
"type": "string",
|
7
|
+
"description": "Component type (TextField, RadioButtons, DateField, etc.)",
|
8
|
+
"title": "Type"
|
9
|
+
},
|
10
|
+
"shortDescription": {
|
11
|
+
"type": "string",
|
12
|
+
"description": "Brief description of the component purpose",
|
13
|
+
"title": "Short Description"
|
14
|
+
},
|
15
|
+
"name": {
|
16
|
+
"type": [
|
17
|
+
"array",
|
18
|
+
"boolean",
|
19
|
+
"number",
|
20
|
+
"object",
|
21
|
+
"string",
|
22
|
+
"null"
|
23
|
+
],
|
24
|
+
"oneOf": [
|
25
|
+
{
|
26
|
+
"type": "string",
|
27
|
+
"description": "Name format for display-only components like HTML, Markdown, etc.",
|
28
|
+
"pattern": "^[a-zA-Z]+$",
|
29
|
+
"title": "Display Component Name"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"type": "string",
|
33
|
+
"description": "Name format for input components that collect user data.",
|
34
|
+
"pattern": "^[a-zA-Z]+$",
|
35
|
+
"title": "Input Component Name"
|
36
|
+
}
|
37
|
+
],
|
38
|
+
"title": "Name",
|
39
|
+
"description": "The name value.",
|
40
|
+
"oneOfTitles": [
|
41
|
+
"Display Component Name",
|
42
|
+
"Input Component Name"
|
43
|
+
]
|
44
|
+
},
|
45
|
+
"title": {
|
46
|
+
"type": [
|
47
|
+
"array",
|
48
|
+
"boolean",
|
49
|
+
"number",
|
50
|
+
"object",
|
51
|
+
"string",
|
52
|
+
"null"
|
53
|
+
],
|
54
|
+
"oneOf": [
|
55
|
+
{
|
56
|
+
"type": "string",
|
57
|
+
"description": "Title format for display-only components.",
|
58
|
+
"title": "Display Component Title"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"type": "string",
|
62
|
+
"description": "Title displayed above input components.",
|
63
|
+
"title": "Input Component Title"
|
64
|
+
}
|
65
|
+
],
|
66
|
+
"title": "Title",
|
67
|
+
"description": "The title value.",
|
68
|
+
"oneOfTitles": [
|
69
|
+
"Display Component Title",
|
70
|
+
"Input Component Title"
|
71
|
+
]
|
72
|
+
},
|
73
|
+
"hint": {
|
74
|
+
"type": "string",
|
75
|
+
"description": "Additional guidance text displayed below the component title",
|
76
|
+
"title": "Hint"
|
77
|
+
},
|
78
|
+
"options": {
|
79
|
+
"type": "object",
|
80
|
+
"description": "Component-specific configuration options",
|
81
|
+
"default": {},
|
82
|
+
"properties": {
|
83
|
+
"rows": {
|
84
|
+
"type": "number",
|
85
|
+
"description": "Number of rows for textarea components",
|
86
|
+
"title": "Rows"
|
87
|
+
},
|
88
|
+
"maxWords": {
|
89
|
+
"type": "number",
|
90
|
+
"description": "Maximum number of words allowed in text inputs",
|
91
|
+
"title": "Max Words"
|
92
|
+
},
|
93
|
+
"maxDaysInPast": {
|
94
|
+
"type": "number",
|
95
|
+
"description": "Maximum days in the past allowed for date inputs",
|
96
|
+
"title": "Max Days In Past"
|
97
|
+
},
|
98
|
+
"maxDaysInFuture": {
|
99
|
+
"type": "number",
|
100
|
+
"description": "Maximum days in the future allowed for date inputs",
|
101
|
+
"title": "Max Days In Future"
|
102
|
+
},
|
103
|
+
"customValidationMessage": {
|
104
|
+
"type": "string",
|
105
|
+
"description": "Custom error message for validation failures",
|
106
|
+
"title": "Custom Validation Message"
|
107
|
+
},
|
108
|
+
"customValidationMessages": {
|
109
|
+
"type": "object",
|
110
|
+
"description": "Custom error messages keyed by validation rule name",
|
111
|
+
"properties": {},
|
112
|
+
"additionalProperties": true,
|
113
|
+
"title": "Custom Validation Messages"
|
114
|
+
}
|
115
|
+
},
|
116
|
+
"additionalProperties": true,
|
117
|
+
"title": "Options"
|
118
|
+
},
|
119
|
+
"schema": {
|
120
|
+
"type": "object",
|
121
|
+
"description": "Validation rules for the component",
|
122
|
+
"default": {},
|
123
|
+
"properties": {
|
124
|
+
"min": {
|
125
|
+
"type": "number",
|
126
|
+
"description": "Minimum value or length for validation",
|
127
|
+
"title": "Min"
|
128
|
+
},
|
129
|
+
"max": {
|
130
|
+
"type": "number",
|
131
|
+
"description": "Maximum value or length for validation",
|
132
|
+
"title": "Max"
|
133
|
+
},
|
134
|
+
"length": {
|
135
|
+
"type": "number",
|
136
|
+
"description": "Exact length required for validation",
|
137
|
+
"title": "Length"
|
138
|
+
}
|
139
|
+
},
|
140
|
+
"additionalProperties": true,
|
141
|
+
"title": "Schema"
|
142
|
+
},
|
143
|
+
"list": {
|
144
|
+
"type": "string",
|
145
|
+
"description": "Reference to a predefined list of options for select components",
|
146
|
+
"title": "List"
|
147
|
+
},
|
148
|
+
"id": {
|
149
|
+
"type": "string",
|
150
|
+
"description": "Auto-generated unique identifier for the component",
|
151
|
+
"format": "uuid",
|
152
|
+
"title": "Id"
|
153
|
+
}
|
154
|
+
},
|
155
|
+
"required": [
|
156
|
+
"type"
|
157
|
+
],
|
158
|
+
"additionalProperties": true,
|
159
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
160
|
+
"title": "Component Schema V2",
|
161
|
+
"$id": "@defra/forms-model/schemas/component-schema-v2.json"
|
162
|
+
}
|
@@ -0,0 +1,162 @@
|
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"description": "Form component definition specifying UI element behavior",
|
4
|
+
"properties": {
|
5
|
+
"id": {
|
6
|
+
"type": "string",
|
7
|
+
"description": "Unique identifier for the component",
|
8
|
+
"format": "uuid",
|
9
|
+
"title": "Id"
|
10
|
+
},
|
11
|
+
"type": {
|
12
|
+
"type": "string",
|
13
|
+
"description": "Component type (TextField, RadioButtons, DateField, etc.)",
|
14
|
+
"title": "Type"
|
15
|
+
},
|
16
|
+
"shortDescription": {
|
17
|
+
"type": "string",
|
18
|
+
"description": "Brief description of the component purpose",
|
19
|
+
"title": "Short Description"
|
20
|
+
},
|
21
|
+
"name": {
|
22
|
+
"type": [
|
23
|
+
"array",
|
24
|
+
"boolean",
|
25
|
+
"number",
|
26
|
+
"object",
|
27
|
+
"string",
|
28
|
+
"null"
|
29
|
+
],
|
30
|
+
"oneOf": [
|
31
|
+
{
|
32
|
+
"type": "string",
|
33
|
+
"description": "Name format for display-only components like HTML, Markdown, etc.",
|
34
|
+
"pattern": "^[a-zA-Z]+$",
|
35
|
+
"title": "Display Component Name"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"type": "string",
|
39
|
+
"description": "Name format for input components that collect user data.",
|
40
|
+
"pattern": "^[a-zA-Z]+$",
|
41
|
+
"title": "Input Component Name"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"title": "Name",
|
45
|
+
"description": "The name value.",
|
46
|
+
"oneOfTitles": [
|
47
|
+
"Display Component Name",
|
48
|
+
"Input Component Name"
|
49
|
+
]
|
50
|
+
},
|
51
|
+
"title": {
|
52
|
+
"type": [
|
53
|
+
"array",
|
54
|
+
"boolean",
|
55
|
+
"number",
|
56
|
+
"object",
|
57
|
+
"string",
|
58
|
+
"null"
|
59
|
+
],
|
60
|
+
"oneOf": [
|
61
|
+
{
|
62
|
+
"type": "string",
|
63
|
+
"description": "Title format for display-only components.",
|
64
|
+
"title": "Display Component Title"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"type": "string",
|
68
|
+
"description": "Title displayed above input components.",
|
69
|
+
"title": "Input Component Title"
|
70
|
+
}
|
71
|
+
],
|
72
|
+
"title": "Title",
|
73
|
+
"description": "The title value.",
|
74
|
+
"oneOfTitles": [
|
75
|
+
"Display Component Title",
|
76
|
+
"Input Component Title"
|
77
|
+
]
|
78
|
+
},
|
79
|
+
"hint": {
|
80
|
+
"type": "string",
|
81
|
+
"description": "Additional guidance text displayed below the component title",
|
82
|
+
"title": "Hint"
|
83
|
+
},
|
84
|
+
"options": {
|
85
|
+
"type": "object",
|
86
|
+
"description": "Component-specific configuration options",
|
87
|
+
"default": {},
|
88
|
+
"properties": {
|
89
|
+
"rows": {
|
90
|
+
"type": "number",
|
91
|
+
"description": "Number of rows for textarea components",
|
92
|
+
"title": "Rows"
|
93
|
+
},
|
94
|
+
"maxWords": {
|
95
|
+
"type": "number",
|
96
|
+
"description": "Maximum number of words allowed in text inputs",
|
97
|
+
"title": "Max Words"
|
98
|
+
},
|
99
|
+
"maxDaysInPast": {
|
100
|
+
"type": "number",
|
101
|
+
"description": "Maximum days in the past allowed for date inputs",
|
102
|
+
"title": "Max Days In Past"
|
103
|
+
},
|
104
|
+
"maxDaysInFuture": {
|
105
|
+
"type": "number",
|
106
|
+
"description": "Maximum days in the future allowed for date inputs",
|
107
|
+
"title": "Max Days In Future"
|
108
|
+
},
|
109
|
+
"customValidationMessage": {
|
110
|
+
"type": "string",
|
111
|
+
"description": "Custom error message for validation failures",
|
112
|
+
"title": "Custom Validation Message"
|
113
|
+
},
|
114
|
+
"customValidationMessages": {
|
115
|
+
"type": "object",
|
116
|
+
"description": "Custom error messages keyed by validation rule name",
|
117
|
+
"properties": {},
|
118
|
+
"additionalProperties": true,
|
119
|
+
"title": "Custom Validation Messages"
|
120
|
+
}
|
121
|
+
},
|
122
|
+
"additionalProperties": true,
|
123
|
+
"title": "Options"
|
124
|
+
},
|
125
|
+
"schema": {
|
126
|
+
"type": "object",
|
127
|
+
"description": "Validation rules for the component",
|
128
|
+
"default": {},
|
129
|
+
"properties": {
|
130
|
+
"min": {
|
131
|
+
"type": "number",
|
132
|
+
"description": "Minimum value or length for validation",
|
133
|
+
"title": "Min"
|
134
|
+
},
|
135
|
+
"max": {
|
136
|
+
"type": "number",
|
137
|
+
"description": "Maximum value or length for validation",
|
138
|
+
"title": "Max"
|
139
|
+
},
|
140
|
+
"length": {
|
141
|
+
"type": "number",
|
142
|
+
"description": "Exact length required for validation",
|
143
|
+
"title": "Length"
|
144
|
+
}
|
145
|
+
},
|
146
|
+
"additionalProperties": true,
|
147
|
+
"title": "Schema"
|
148
|
+
},
|
149
|
+
"list": {
|
150
|
+
"type": "string",
|
151
|
+
"description": "Reference to a predefined list of options for select components",
|
152
|
+
"title": "List"
|
153
|
+
}
|
154
|
+
},
|
155
|
+
"required": [
|
156
|
+
"type"
|
157
|
+
],
|
158
|
+
"additionalProperties": true,
|
159
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
160
|
+
"title": "Component Schema",
|
161
|
+
"$id": "@defra/forms-model/schemas/component-schema.json"
|
162
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"type": "string",
|
3
|
+
"enum": [
|
4
|
+
"DatePartsField",
|
5
|
+
"MonthYearField"
|
6
|
+
],
|
7
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
8
|
+
"title": "Date Sub Schema",
|
9
|
+
"description": "JSON Schema for validating Date Sub Schema in Defra forms",
|
10
|
+
"$id": "@defra/forms-model/schemas/date-sub-schema.json"
|
11
|
+
}
|