-
Notifications
You must be signed in to change notification settings - Fork 1
Klamm Forms Template Schema (Version 2.0)
Spencer Rose edited this page Jun 20, 2025
·
1 revision
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://klamm.social.gov.bc.ca/new-forms-schema.json",
"title": "Klamm Form Definition",
"description": "Schema for defining a complete form based on the Klamm data model ERD (v2.0).",
"type": "object",
"required": [
"formId",
"formTitle",
"data"
],
"properties": {
"formId": {
"type": "string",
"description": "Unique identifier for the form, maps to Forms.forms_id."
},
"formTitle": {
"type": "string",
"description": "The title of the form, maps to Forms.form_title."
},
"ministryId": {
"type": ["integer", "null"],
"description": "Optional: The ID of the ministry, maps to Forms.ministry_id."
},
"description": {
"type": ["string", "null"],
"description": "Optional: Description of the form, maps to Forms.description."
},
"notes": {
"type": ["string", "null"],
"description": "Optional: General notes about the form, maps to Forms.notes."
},
"formFrequenciesId": {
"type": ["integer", "null"],
"description": "Optional: Foreign key to form_frequencies table, maps to Forms.form_frequencies_id."
},
"formReachesId": {
"type": ["integer", "null"],
"description": "Optional: Foreign key to form_reaches table, maps to Forms.form_reaches_id."
},
"printReason": {
"type": ["string", "null"],
"description": "Optional: Reason for printing, maps to Forms.print_reason."
},
"retentionNeeds": {
"type": ["string", "null"],
"description": "Optional: Retention needs, maps to Forms.retention_needs."
},
"icmNonInteractive": {
"type": "boolean",
"description": "Optional: Indicates if ICM is non-interactive, maps to Forms.icm_non_interactive."
},
"workbenchFooterFragmentPath": {
"type": ["string", "null"],
"description": "Optional: Path to the workbench footer fragment, maps to Forms.workbench_footer_fragment_path."
},
"dcvMaterialNumber": {
"type": ["string", "null"],
"description": "Optional: DCV material number, maps to Forms.dcv_material_number."
},
"orbeonFunctions": {
"type": ["string", "null"],
"description": "Optional: Orbeon functions, maps to Forms.orbeon_functions."
},
"icmGenerated": {
"type": "boolean",
"description": "Optional: Indicates if ICM generated, maps to Forms.icm_generated."
},
"version": {
"type": "object",
"description": "Details about this specific form version, maps to FormVersions.",
"required": [
"uuid",
"versionNumber",
"status"
],
"properties": {
"uuid": {
"type": "string",
"format": "uuid",
"description": "UUID of this form version, maps to FormVersions.uuid."
},
"versionNumber": {
"type": "integer",
"description": "Version number, maps to FormVersions.version_number."
},
"status": {
"type": "string",
"enum": ["draft", "approved", "final"],
"description": "Status of the form version, maps to FormVersions.status."
},
"formDeveloperId": {
"type": ["integer", "null"],
"description": "Optional: ID of the form developer, maps to FormVersions.form_developer_id."
}
}
},
"deployments": {
"type": "array",
"description": "List of deployments for this form version, maps to FormDeployments.",
"items": {
"$ref": "#/definitions/formDeployment"
}
},
"stylesheets": {
"type": "array",
"description": "List of stylesheets applied to this form version, maps to FormStylesheets.",
"items": {
"$ref": "#/definitions/formStylesheet"
}
},
"scripts": {
"type": "array",
"description": "List of scripts applied to this form version, maps to FormScripts.",
"items": {
"$ref": "#/definitions/formScript"
}
},
"data": {
"type": "array",
"description": "The root elements of the form structure, maps to FormElements.",
"items": {
"$ref": "#/definitions/formElement"
}
}
},
"definitions": {
"formDeployment": {
"type": "object",
"required": [
"environment",
"deployedAt"
],
"properties": {
"environment": {
"type": "string",
"enum": ["test", "dev", "prod"],
"description": "Deployment environment, maps to FormDeployments.environment."
},
"deployedAt": {
"type": "string",
"format": "date-time",
"description": "Timestamp of deployment, maps to FormDeployments.deployed_at."
}
}
},
"formStylesheet": {
"type": "object",
"required": [
"filepath",
"name",
"type"
],
"properties": {
"filepath": {
"type": "string",
"description": "File path of the stylesheet, maps to FormStylesheets.filepath."
},
"name": {
"type": "string",
"description": "Name of the stylesheet, maps to FormStylesheets.name."
},
"type": {
"type": "string",
"enum": ["web", "pdf"],
"description": "Type of stylesheet (web or pdf), maps to FormStylesheets.type."
},
"description": {
"type": ["string", "null"],
"description": "Optional: Description of the stylesheet, maps to FormStylesheets.description."
}
}
},
"formScript": {
"type": "object",
"required": [
"filepath",
"name",
"type"
],
"properties": {
"filepath": {
"type": "string",
"description": "File path of the script, maps to FormScripts.filepath."
},
"name": {
"type": "string",
"description": "Name of the script, maps to FormScripts.name."
},
"type": {
"type": "string",
"enum": ["web", "pdf"],
"description": "Type of script (web or pdf), maps to FormScripts.type."
},
"description": {
"type": ["string", "null"],
"description": "Optional: Description of the script, maps to FormScripts.description."
}
}
},
"formFieldDataBinding": {
"type": "object",
"required": [
"name",
"dataBindingPath",
"dataBindingType"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the data binding, maps to FormFieldDataBindings.name."
},
"description": {
"type": ["string", "null"],
"description": "Optional: Description of the data binding, maps to FormFieldDataBindings.description."
},
"dataBindingPath": {
"type": "string",
"description": "The data binding path, maps to FormFieldDataBindings.data_binding_path."
},
"dataBindingType": {
"type": "string",
"description": "The type of data binding, maps to FormFieldDataBindings.data_binding_type."
}
}
},
"formFieldValidator": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the validator (e.g., 'required', 'regex'), maps to FormFieldValidators.name."
},
"regex": {
"type": ["string", "null"],
"description": "Optional: Regex pattern for validation, maps to FormFieldValidators.regex."
},
"description": {
"type": ["string", "null"],
"description": "Optional: Description of the validator, maps to FormFieldValidators.description."
}
}
},
"baseFormElement": {
"type": "object",
"required": [
"token",
"name",
"elementType"
],
"properties": {
"token": {
"type": "string",
"format": "uuid",
"description": "Unique UUID for the element instance, maps to FormElements.token."
},
"parentId": {
"type": ["string", "null"],
"format": "uuid",
"description": "Optional: UUID of the parent element, maps to FormElements.parent_id. Null for root elements."
},
"name": {
"type": "string",
"description": "Programmatic name of the element, maps to FormElements.name."
},
"elementType": {
"type": "string",
"enum": [
"TextInputFormElements",
"CheckboxInputFormElements",
"SelectInputFormElements",
"RadioInputFormElements",
"TextareaInputFormElements",
"NumberInputFormElements",
"DateSelectInputFormElements",
"ButtonInputFormElements",
"ContainerFormElements",
"HTMLFormElements"
],
"description": "The type of form element, maps to FormElements.elementable_type."
},
"helpText": {
"type": ["string", "null"],
"description": "Optional: Help text for the element, maps to FormElements.help_text."
},
"description": {
"type": ["string", "null"],
"description": "Optional: Description of the element, maps to FormElements.description."
},
"isRepeatable": {
"type": "boolean",
"description": "Optional: Indicates if the element is repeatable, maps to FormElements.is_repeatable."
},
"repeaterItemLabel": {
"type": ["string", "null"],
"description": "Optional: Label for repeated items, maps to FormElements.repeater_item_label."
},
"isResetable": {
"type": "boolean",
"description": "Optional: Indicates if the element is resetable, maps to FormElements.is_resetable."
},
"visibleWeb": {
"type": "boolean",
"description": "Optional: Indicates if visible on web, maps to FormElements.visible_web."
},
"visiblePdf": {
"type": "boolean",
"description": "Optional: Indicates if visible on PDF, maps to FormElements.visible_pdf."
}
}
},
"formElement": {
"type": "object",
"description": "A polymorphic form element.",
"oneOf": [
{ "$ref": "#/definitions/textInputFormElement" },
{ "$ref": "#/definitions/checkboxInputFormElement" },
{ "$ref": "#/definitions/selectInputFormElement" },
{ "$ref": "#/definitions/radioInputFormElement" },
{ "$ref": "#/definitions/textareaInputFormElement" },
{ "$ref": "#/definitions/numberInputFormElement" },
{ "$ref": "#/definitions/dateSelectInputFormElement" },
{ "$ref": "#/definitions/buttonInputFormElement" },
{ "$ref": "#/definitions/containerFormElement" },
{ "$ref": "#/definitions/htmlFormElement" }
]
},
"textInputFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "TextInputFormElements" },
"placeholderText": {
"type": ["string", "null"],
"description": "Maps to TextInputFormElements.placeholder_text."
},
"label": {
"type": ["string", "null"],
"description": "Maps to TextInputFormElements.label."
},
"visibleLabel": {
"type": "boolean",
"description": "Maps to TextInputFormElements.visible_label."
},
"mask": {
"type": ["string", "null"],
"description": "Maps to TextInputFormElements.mask."
},
"maxlength": {
"type": ["integer", "null"],
"description": "Maps to TextInputFormElements.maxlength."
},
"minlength": {
"type": ["integer", "null"],
"description": "Maps to TextInputFormElements.minlength."
},
"dataBinding": {
"type": "object",
"description": "Optional: Data binding for this field, maps to FormFieldDataBindings.",
"allOf": [{ "$ref": "#/definitions/formFieldDataBinding" }]
},
"validators": {
"type": "array",
"description": "Optional: List of validators for this field, maps to FormFieldValidators.",
"items": { "$ref": "#/definitions/formFieldValidator" }
}
}
},
"checkboxInputFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "CheckboxInputFormElements" },
"label": {
"type": ["string", "null"],
"description": "Maps to CheckboxInputFormElements.label."
},
"visibleLabel": {
"type": "boolean",
"description": "Maps to CheckboxInputFormElements.visible_label."
},
"dataBinding": {
"type": "object",
"description": "Optional: Data binding for this field, maps to FormFieldDataBindings.",
"allOf": [{ "$ref": "#/definitions/formFieldDataBinding" }]
},
"validators": {
"type": "array",
"description": "Optional: List of validators for this field, maps to FormFieldValidators.",
"items": { "$ref": "#/definitions/formFieldValidator" }
}
}
},
"selectInputFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "SelectInputFormElements" },
"label": {
"type": ["string", "null"],
"description": "Maps to SelectInputFormElements.label."
},
"visibleLabel": {
"type": "boolean",
"description": "Maps to SelectInputFormElements.visible_label."
},
"dataBinding": {
"type": "object",
"description": "Optional: Data binding for this field, maps to FormFieldDataBindings.",
"allOf": [{ "$ref": "#/definitions/formFieldDataBinding" }]
},
"options": {
"type": "array",
"description": "List of options for the select input, maps to SelectOptionFormElements.",
"items": { "$ref": "#/definitions/selectOptionFormElement" }
},
"validators": {
"type": "array",
"description": "Optional: List of validators for this field, maps to FormFieldValidators.",
"items": { "$ref": "#/definitions/formFieldValidator" }
}
}
},
"selectOptionFormElement": {
"type": "object",
"required": [
"label"
],
"properties": {
"label": {
"type": "string",
"description": "Display label for the option, maps to SelectOptionFormElements.label."
},
"order": {
"type": ["integer", "null"],
"description": "Optional: Display order of the option, maps to SelectOptionFormElements.order."
},
"description": {
"type": ["string", "null"],
"description": "Optional: Description of the option, maps to SelectOptionFormElements.description."
}
}
},
"radioInputFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "RadioInputFormElements" },
"label": {
"type": ["string", "null"],
"description": "Maps to RadioInputFormElements.label."
},
"visibleLabel": {
"type": "boolean",
"description": "Maps to RadioInputFormElements.visible_label."
},
"options": {
"type": "array",
"items": { "type": "string" },
"description": "List of string options for radio buttons, maps to RadioInputFormElements.options."
},
"defaultValue": {
"type": ["string", "null"],
"description": "Maps to RadioInputFormElements.default_value."
},
"dataBinding": {
"type": "object",
"description": "Optional: Data binding for this field, maps to FormFieldDataBindings.",
"allOf": [{ "$ref": "#/definitions/formFieldDataBinding" }]
},
"validators": {
"type": "array",
"description": "Optional: List of validators for this field, maps to FormFieldValidators.",
"items": { "$ref": "#/definitions/formFieldValidator" }
}
}
},
"textareaInputFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "TextareaInputFormElements" },
"placeholderText": {
"type": ["string", "null"],
"description": "Maps to TextareaInputFormElements.placeholder_text."
},
"label": {
"type": ["string", "null"],
"description": "Maps to TextareaInputFormElements.label."
},
"visibleLabel": {
"type": "boolean",
"description": "Maps to TextareaInputFormElements.visible_label."
},
"rows": {
"type": ["integer", "null"],
"description": "Maps to TextareaInputFormElements.rows."
},
"cols": {
"type": ["integer", "null"],
"description": "Maps to TextareaInputFormElements.cols."
},
"maxlength": {
"type": ["integer", "null"],
"description": "Maps to TextareaInputFormElements.maxlength."
},
"minlength": {
"type": ["integer", "null"],
"description": "Maps to TextareaInputFormElements.minlength."
},
"dataBinding": {
"type": "object",
"description": "Optional: Data binding for this field, maps to FormFieldDataBindings.",
"allOf": [{ "$ref": "#/definitions/formFieldDataBinding" }]
},
"validators": {
"type": "array",
"description": "Optional: List of validators for this field, maps to FormFieldValidators.",
"items": { "$ref": "#/definitions/formFieldValidator" }
}
}
},
"numberInputFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "NumberInputFormElements" },
"placeholderText": {
"type": ["string", "null"],
"description": "Maps to NumberInputFormElements.placeholder_text."
},
"label": {
"type": ["string", "null"],
"description": "Maps to NumberInputFormElements.label."
},
"visibleLabel": {
"type": "boolean",
"description": "Maps to NumberInputFormElements.visible_label."
},
"min": {
"type": ["number", "null"],
"description": "Maps to NumberInputFormElements.min."
},
"max": {
"type": ["number", "null"],
"description": "Maps to NumberInputFormElements.max."
},
"step": {
"type": ["number", "null"],
"description": "Maps to NumberInputFormElements.step."
},
"defaultValue": {
"type": ["number", "null"],
"description": "Maps to NumberInputFormElements.default_value."
},
"dataBinding": {
"type": "object",
"description": "Optional: Data binding for this field, maps to FormFieldDataBindings.",
"allOf": [{ "$ref": "#/definitions/formFieldDataBinding" }]
},
"validators": {
"type": "array",
"description": "Optional: List of validators for this field, maps to FormFieldValidators.",
"items": { "$ref": "#/definitions/formFieldValidator" }
}
}
},
"dateSelectInputFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "DateSelectInputFormElements" },
"placeholderText": {
"type": ["string", "null"],
"description": "Maps to DateSelectInputFormElements.placeholder_text."
},
"label": {
"type": ["string", "null"],
"description": "Maps to DateSelectInputFormElements.label."
},
"visibleLabel": {
"type": "boolean",
"description": "Maps to DateSelectInputFormElements.visible_label."
},
"minDate": {
"type": ["string", "null"],
"format": "date",
"description": "Maps to DateSelectInputFormElements.min_date."
},
"maxDate": {
"type": ["string", "null"],
"format": "date",
"description": "Maps to DateSelectInputFormElements.max_date."
},
"defaultDate": {
"type": ["string", "null"],
"format": "date",
"description": "Maps to DateSelectInputFormElements.default_date."
},
"dateFormat": {
"type": ["string", "null"],
"description": "Maps to DateSelectInputFormElements.date_format."
},
"includeTime": {
"type": "boolean",
"description": "Maps to DateSelectInputFormElements.include_time."
},
"dataBinding": {
"type": "object",
"description": "Optional: Data binding for this field, maps to FormFieldDataBindings.",
"allOf": [{ "$ref": "#/definitions/formFieldDataBinding" }]
},
"validators": {
"type": "array",
"description": "Optional: List of validators for this field, maps to FormFieldValidators.",
"items": { "$ref": "#/definitions/formFieldValidator" }
}
}
},
"buttonInputFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "ButtonInputFormElements" },
"label": {
"type": ["string", "null"],
"description": "Maps to ButtonInputFormElements.label."
},
"buttonType": {
"type": "string",
"enum": ["submit", "reset", "button"],
"description": "Maps to ButtonInputFormElements.button_type."
}
}
},
"containerFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "ContainerFormElements" },
"containerType": {
"type": "string",
"enum": ["page", "fieldset", "section"],
"description": "Type of container, maps to ContainerFormElements.container_type."
},
"collapsible": {
"type": "boolean",
"description": "Optional: Indicates if the container is collapsible, maps to ContainerFormElements.collapsible."
},
"collapsedByDefault": {
"type": "boolean",
"description": "Optional: Indicates if the container is collapsed by default, maps to ContainerFormElements.collapsed_by_default."
},
"elements": {
"type": "array",
"description": "Child elements within this container, maps to FormElements.parent_id.",
"items": { "$ref": "#/definitions/formElement" }
}
}
},
"htmlFormElement": {
"type": "object",
"allOf": [{ "$ref": "#/definitions/baseFormElement" }],
"properties": {
"elementType": { "const": "HTMLFormElements" },
"htmlContent": {
"type": "string",
"description": "Raw HTML content to embed, maps to HTMLFormElements.html_content."
}
}
}
}
}