-
Notifications
You must be signed in to change notification settings - Fork 1
Form Template Schema Update
Spencer Rose edited this page Jul 10, 2025
·
2 revisions
| Change Item | Schema Version 1.0 | Schema Version 2.0 |
|---|---|---|
| form_id / formId | Required string, maps to Forms.forms_id. | Required string, maps to Forms.forms_id. |
| title / formTitle | Required string, maps to Forms.form_title. | Required string, maps to Forms.form_title. |
| ministry_id / ministryId | Optional integer or null, maps to Forms.ministry_id. | Optional integer or null, maps to Forms.ministry_id. |
| deployed_to | Optional string or null, describes deployment target. | Removed in V2. Deployment information is now under the deployments array. |
| dataSources | Optional array of objects with name (string), describes data sources. | To be upd |
| data | Required object with a required items array of containerElement, groupElement, or fieldElement. Represents the main content structure. | Required array of formElement (polymorphic types like textInputFormElement, checkboxInputFormElement, etc.). Represents the root elements of the form structure. |
| baseElementProperties | Definition for common properties: id (string), conditions (array of objects), webStyles (object), pdfStyles (object). | Replaced by baseFormElement in V2. |
| containerElement | Defines a container with type: "container", id, and containerItems (array of groupElement or fieldElement). | Replaced by containerFormElement in V2. V2's containerFormElement also includes containerType, collapsible, collapsedByDefault, and elements (array of formElement). |
| groupElement | Defines a field group with type: "group", id, codeContext (with name), optional label, repeater, databindings, repeaterItemLabel, and groupItems (array with a fields array of fieldElement). | No direct equivalent in V2 as a distinct top-level element type. Repeatable functionality is now a property (isRepeatable, repeaterItemLabel) on baseFormElement and containerFormElement. Data binding is also handled differently. |
| fieldElement | Defines a single form field with type (enum: 'text-input', 'number-input', 'select', 'checkbox', 'date', 'text-info'), id, codeContext (with name), optional label, databindings, mask, helperText, value, validation, listItems. | Replaced by various specific input form element definitions in V2 (e.g., textInputFormElement, checkboxInputFormElement, selectInputFormElement, radioInputFormElement, textareaInputFormElement, numberInputFormElement, dateSelectInputFormElement, buttonInputFormElement, htmlFormElement). V2 separates each field type into its own definition, inheriting from baseFormElement. |
| codeContext (within groupElement and fieldElement) | Object with a required name (string) for programmatic name. | Removed in V2. The programmatic name is now directly name on baseFormElement. |
| conditions | Optional array of objects with type and value for controlling element properties. | No direct equivalent in V2 schema. This functionality would likely be handled by application logic rather than directly in the form definition schema. |
| webStyles and pdfStyles | Optional objects for key-value CSS pairs. | No direct equivalent in V2 schema. Stylesheets are now defined globally for the form version via the stylesheets array. |
| databindings (within groupElement and fieldElement) | Optional object with source and path. | Replaced by dataBinding object in V2 (within field elements) which refers to formFieldDataBinding definition (with name, description, dataBindingPath, dataBindingType). |
| validation (within fieldElement) | Optional array of objects with type, value, and errorMessage. | Replaced by validators array in V2 (within field elements) which refers to formFieldValidator definition (with name, regex, description). Error messages are not part of the schema definition itself in V2. |
| listItems (within fieldElement for select/dropdown) | Optional array of objects with name, text, value for options. | Replaced by options array in V2 (within selectInputFormElement and radioInputFormElement). selectInputFormElement uses selectOptionFormElement (with label, order, description), while radioInputFormElement uses a simple array of strings for options. |
| New in V2: formId | N/A | Unique identifier for the form, maps to Forms.forms_id. |
| New in V2: formTitle | N/A | The title of the form, maps to Forms.form_title. |
| New in V2: description | N/A | Optional: Description of the form, maps to Forms.description. |
| New in V2: notes | N/A | Optional: General notes about the form, maps to Forms.notes. |
| New in V2: formFrequenciesId | N/A | Optional: Foreign key to form_frequencies table, maps to Forms.form_frequencies_id. |
| New in V2: formReachesId | N/A | Optional: Foreign key to form_reaches table, maps to Forms.form_reaches_id. |
| New in V2: printReason | N/A | Optional: Reason for printing, maps to Forms.print_reason. |
| New in V2: retentionNeeds | N/A | Optional: Retention needs, maps to Forms.retention_needs. |
| New in V2: icmNonInteractive | N/A | Optional: Indicates if ICM is non-interactive, maps to Forms.icm_non_interactive. |
| New in V2: workbenchFooterFragmentPath | N/A | Optional: Path to the workbench footer fragment, maps to Forms.workbench_footer_fragment_path. |
| New in V2: dcvMaterialNumber | N/A | Optional: DCV material number, maps to Forms.dcv_material_number. |
| New in V2: orbeonFunctions | N/A | Optional: Orbeon functions, maps to Forms.orbeon_functions. |
| New in V2: icmGenerated | N/A | Optional: Indicates if ICM generated, maps to Forms.icm_generated. |
| New in V2: version | N/A | Details about this specific form version, maps to FormVersions. Includes uuid, versionNumber, status (enum: 'draft', 'approved', 'final'), and optional formDeveloperId. |
| New in V2: deployments | N/A | List of deployments for this form version, maps to FormDeployments. Each item has environment (enum: 'test', 'dev', 'prod') and deployedAt (date-time). |
| New in V2: stylesheets | N/A | List of stylesheets applied to this form version, maps to FormStylesheets. Each item has filepath, name, type (enum: 'web', 'pdf'), and optional description. |
| New in V2: scripts | N/A | List of scripts applied to this form version, maps to FormScripts. Each item has filepath, name, type (enum: 'web', 'pdf'), and optional description. |
| New in V2: formFieldDataBinding | N/A | Definition for data binding: name, description (optional), dataBindingPath, dataBindingType. |
| New in V2: formFieldValidator | N/A | Definition for field validators: name, regex (optional), description (optional). |
| New in V2: baseFormElement | N/A | Base definition for all form elements: token (UUID), parentId (optional UUID), name, elementType (enum of all specific element types), helpText (optional), description (optional), isRepeatable (boolean), repeaterItemLabel (optional), isResetable (boolean), visibleWeb (boolean), visiblePdf (boolean). |
| New in V2: Specific Input Form Element Definitions | N/A | V2 introduces distinct definitions for each input type, inheriting from baseFormElement: textInputFormElement, checkboxInputFormElement, selectInputFormElement, radioInputFormElement, textareaInputFormElement, numberInputFormElement, dateSelectInputFormElement, buttonInputFormElement, containerFormElement, htmlFormElement. Each includes properties specific to its element type (e.g., placeholderText, label, minlength, maxlength, options, min, max, dateFormat, htmlContent). |
| New in V2: selectOptionFormElement | N/A | Definition for options within a selectInputFormElement: label, order (optional), description (optional). |
| Naming Convention | Uses snake_case for top-level properties and some nested properties (e.g., form_id, ministry_id, deployed_to). | Uses camelCase for most properties (e.g., formId, ministryId, formTitle). |
| Data Model Mapping | Descriptions often mention "used to find or create a Form record" or general usage. | Descriptions explicitly map properties to database tables and columns (e.g., "maps to Forms.forms_id"). |
| Element Identification | id field for elements, which can be element + number or custom. | token field (UUID format) for unique element instance identification, and name for programmatic name. parentId links child elements to containers. |
| Form Structure Depth | data has items array, which contains containerItems or groupItems (which have fields). | data is a direct array of formElement. Containers (containerFormElement) have an elements array for their children. This suggests a flatter, more direct representation of the form hierarchy. |
| Type Definition Strategy | Uses allOf for containerElement, groupElement, fieldElement to include baseElementProperties. | Uses allOf for specific form elements to include baseFormElement. Employs oneOf for the formElement definition to allow for polymorphic elements. |