diff --git a/src/openforms/authentication/static_variables/static_variables.py b/src/openforms/authentication/static_variables/static_variables.py
index 535f7bdead..77cab2b858 100644
--- a/src/openforms/authentication/static_variables/static_variables.py
+++ b/src/openforms/authentication/static_variables/static_variables.py
@@ -92,7 +92,7 @@ def as_json_schema(self):
return {
"title": "Authentication type",
"type": "string",
- "enum": AuthAttribute.values,
+ "enum": [*AuthAttribute.values, ""],
}
diff --git a/src/openforms/forms/json_schema.py b/src/openforms/forms/json_schema.py
index 96c732db14..9298409fd1 100644
--- a/src/openforms/forms/json_schema.py
+++ b/src/openforms/forms/json_schema.py
@@ -1,23 +1,38 @@
from typing import Iterator, Sequence
+from openforms.plugins.registry import BaseRegistry
from openforms.typing import JSONObject
+from openforms.variables.base import BaseStaticVariable
from openforms.variables.service import get_static_variables
from .models import Form, FormVariable
-def _iter_form_variables(form: Form) -> Iterator[FormVariable]:
+def _iter_form_variables(
+ form: Form,
+ additional_variables_registry: BaseRegistry[BaseStaticVariable] | None = None,
+) -> Iterator[FormVariable]:
"""Iterate over static variables and all form variables.
:param form: Form
+ :param additional_variables_registry: Optional registry of static variables.
"""
# Static variables are always available
yield from get_static_variables()
+ # If the optional variables registry is passed
+ if additional_variables_registry is not None:
+ yield from get_static_variables(
+ variables_registry=additional_variables_registry
+ )
# Handle from variables holding dynamic data (component and user defined)
yield from form.formvariable_set.all()
-def generate_json_schema(form: Form, limit_to_variables: Sequence[str]) -> JSONObject:
+def generate_json_schema(
+ form: Form,
+ limit_to_variables: Sequence[str],
+ additional_variables_registry: BaseRegistry[BaseStaticVariable] | None = None,
+) -> JSONObject:
"""Generate a JSON schema from a form, for the specified variables.
Note: this schema is an informative description of the variables and should not be
@@ -25,12 +40,13 @@ def generate_json_schema(form: Form, limit_to_variables: Sequence[str]) -> JSONO
:param form: The form to generate JSON schema for.
:param limit_to_variables: Variables that will be included in the schema.
+ :param additional_variables_registry: Optional extra registry of static variables.
:returns: A JSON schema representing the form variables.
"""
requested_variables_schema = {
key: variable.as_json_schema()
- for variable in _iter_form_variables(form)
+ for variable in _iter_form_variables(form, additional_variables_registry)
if (key := variable.key) in limit_to_variables
}
diff --git a/src/openforms/js/compiled-lang/en.json b/src/openforms/js/compiled-lang/en.json
index 75b04f71e7..4eb42e76f0 100644
--- a/src/openforms/js/compiled-lang/en.json
+++ b/src/openforms/js/compiled-lang/en.json
@@ -587,6 +587,12 @@
"value": "The maximum length requirement this field must meet."
}
],
+ "5EOSwM": [
+ {
+ "type": 0,
+ "value": "Additional"
+ }
+ ],
"5JNnFB": [
{
"type": 0,
@@ -1377,6 +1383,12 @@
"value": "Boolean"
}
],
+ "BiKRJT": [
+ {
+ "type": 0,
+ "value": "Key"
+ }
+ ],
"Bin/vM": [
{
"type": 0,
@@ -1541,12 +1553,6 @@
"value": "length"
}
],
- "CZ774U": [
- {
- "type": 0,
- "value": "Which variables to include in the data to be sent"
- }
- ],
"Cf5zSF": [
{
"type": 0,
@@ -1571,6 +1577,12 @@
"value": "Submission allowed"
}
],
+ "Cz+O0n": [
+ {
+ "type": 0,
+ "value": "Source"
+ }
+ ],
"D0hDzV": [
{
"type": 1,
@@ -2275,12 +2287,6 @@
"value": " is unknown. We can only display the JSON definition."
}
],
- "Ibejpf": [
- {
- "type": 0,
- "value": "Path relative to the Service API root"
- }
- ],
"Igt0Rc": [
{
"type": 0,
@@ -2431,6 +2437,12 @@
"value": "Override the minimum Level of Assurance. This is not supported by all authentication plugins."
}
],
+ "JfgATN": [
+ {
+ "type": 0,
+ "value": "Additional variables to include."
+ }
+ ],
"JhdlEg": [
{
"type": 0,
@@ -2493,6 +2505,12 @@
"value": "Content"
}
],
+ "KMTsJc": [
+ {
+ "type": 0,
+ "value": "Static"
+ }
+ ],
"KMbfsU": [
{
"type": 0,
@@ -2869,6 +2887,12 @@
"value": ". Extend your session if you wish to continue."
}
],
+ "Od+jm6": [
+ {
+ "type": 0,
+ "value": "Values:"
+ }
+ ],
"Oi+DV0": [
{
"children": [
@@ -3779,6 +3803,12 @@
"value": "Active"
}
],
+ "X+NeMd": [
+ {
+ "type": 0,
+ "value": "Include variable in metadata"
+ }
+ ],
"X18/UP": [
{
"type": 0,
@@ -3863,6 +3893,12 @@
"value": "Remove"
}
],
+ "Xpw7Gk": [
+ {
+ "type": 0,
+ "value": "Whether to include this variable in the metadata to be sent."
+ }
+ ],
"XyDeaD": [
{
"type": 0,
@@ -4263,6 +4299,12 @@
"value": "Objecttype"
}
],
+ "bmUuAH": [
+ {
+ "type": 0,
+ "value": "Fixed"
+ }
+ ],
"bmlODS": [
{
"type": 0,
@@ -5059,6 +5101,12 @@
"value": "Are you sure you want to delete this variable?"
}
],
+ "hfeO2r": [
+ {
+ "type": 0,
+ "value": "Registration"
+ }
+ ],
"hhoWxC": [
{
"type": 0,
@@ -5119,6 +5167,12 @@
"value": "Description"
}
],
+ "iQblZd": [
+ {
+ "type": 0,
+ "value": "Variables that are already included."
+ }
+ ],
"iX0YPY": [
{
"options": {
@@ -5679,6 +5733,12 @@
"value": "House number"
}
],
+ "mfD7J5": [
+ {
+ "type": 0,
+ "value": "Name"
+ }
+ ],
"mpzdoT": [
{
"type": 0,
@@ -5709,6 +5769,12 @@
"value": "Whether to add children information to the component."
}
],
+ "nEg4dr": [
+ {
+ "type": 0,
+ "value": "Metadata:"
+ }
+ ],
"nFXYHB": [
{
"type": 0,
@@ -5871,6 +5937,12 @@
"value": "The regular expression pattern test that the city field value must pass before the form can be submitted."
}
],
+ "ow5LZk": [
+ {
+ "type": 0,
+ "value": "Variables to include in the data to be sent."
+ }
+ ],
"oxYXJX": [
{
"type": 0,
@@ -6075,12 +6147,6 @@
"value": "This template is evaluated with the submission data when the payment is received. The resulting JSON is sent to the objects API to update (the payment fields of) the earlier created object."
}
],
- "qPiUic": [
- {
- "type": 0,
- "value": "Which service to send the data to"
- }
- ],
"qUYLVg": [
{
"type": 0,
@@ -6247,6 +6313,12 @@
"value": "(not configured yet)"
}
],
+ "sAfROS": [
+ {
+ "type": 0,
+ "value": "Metadata variables"
+ }
+ ],
"sCkGL9": [
{
"type": 0,
@@ -6293,6 +6365,12 @@
"value": " 3"
}
],
+ "sokfvf": [
+ {
+ "type": 0,
+ "value": "The service to send the data to."
+ }
+ ],
"sptpzv": [
{
"type": 0,
@@ -6467,6 +6545,12 @@
"value": "Amount of days successful submissions of this form will remain before being removed. Leave blank to use value in General Configuration."
}
],
+ "uUf7cu": [
+ {
+ "type": 0,
+ "value": "Path relative to the Service API root."
+ }
+ ],
"uVVO4b": [
{
"type": 0,
diff --git a/src/openforms/js/compiled-lang/nl.json b/src/openforms/js/compiled-lang/nl.json
index c4b72ebca8..45b1bcbacd 100644
--- a/src/openforms/js/compiled-lang/nl.json
+++ b/src/openforms/js/compiled-lang/nl.json
@@ -587,6 +587,12 @@
"value": "De maximale toegestane lengte voor dit veld."
}
],
+ "5EOSwM": [
+ {
+ "type": 0,
+ "value": "Additional"
+ }
+ ],
"5JNnFB": [
{
"type": 0,
@@ -1381,6 +1387,12 @@
"value": "Waar/vals (boolean)"
}
],
+ "BiKRJT": [
+ {
+ "type": 0,
+ "value": "Key"
+ }
+ ],
"Bin/vM": [
{
"type": 0,
@@ -1545,12 +1557,6 @@
"value": "length"
}
],
- "CZ774U": [
- {
- "type": 0,
- "value": "Which variables to include in the data to be sent"
- }
- ],
"Cf5zSF": [
{
"type": 0,
@@ -1575,6 +1581,12 @@
"value": "Inzenden toegestaan"
}
],
+ "Cz+O0n": [
+ {
+ "type": 0,
+ "value": "Source"
+ }
+ ],
"D0hDzV": [
{
"type": 1,
@@ -2296,12 +2308,6 @@
"value": " is niet bekend. We kunnen enkel de JSON-definitie weergeven."
}
],
- "Ibejpf": [
- {
- "type": 0,
- "value": "Path relative to the Service API root"
- }
- ],
"Igt0Rc": [
{
"type": 0,
@@ -2448,6 +2454,12 @@
"value": "Overschrijf het vereiste minimale betrouwbaarheidsniveau. Niet alle authenticatieplugins ondersteunen dit."
}
],
+ "JfgATN": [
+ {
+ "type": 0,
+ "value": "Additional variables to include."
+ }
+ ],
"JhdlEg": [
{
"type": 0,
@@ -2510,6 +2522,12 @@
"value": "Inhoud"
}
],
+ "KMTsJc": [
+ {
+ "type": 0,
+ "value": "Static"
+ }
+ ],
"KMbfsU": [
{
"type": 0,
@@ -2886,6 +2904,12 @@
"value": ". Verleng uw sessie indien u wenst door te gaan."
}
],
+ "Od+jm6": [
+ {
+ "type": 0,
+ "value": "Values:"
+ }
+ ],
"Oi+DV0": [
{
"children": [
@@ -3792,6 +3816,12 @@
"value": "Actief"
}
],
+ "X+NeMd": [
+ {
+ "type": 0,
+ "value": "Include variable in metadata"
+ }
+ ],
"X18/UP": [
{
"type": 0,
@@ -3876,6 +3906,12 @@
"value": "Verwijderen"
}
],
+ "Xpw7Gk": [
+ {
+ "type": 0,
+ "value": "Whether to include this variable in the metadata to be sent."
+ }
+ ],
"XyDeaD": [
{
"type": 0,
@@ -4281,6 +4317,12 @@
"value": "Objecttype"
}
],
+ "bmUuAH": [
+ {
+ "type": 0,
+ "value": "Fixed"
+ }
+ ],
"bmlODS": [
{
"type": 0,
@@ -5077,6 +5119,12 @@
"value": "Bent u zeker dat u deze variabele wilt verwijderen?"
}
],
+ "hfeO2r": [
+ {
+ "type": 0,
+ "value": "Registration"
+ }
+ ],
"hhoWxC": [
{
"type": 0,
@@ -5137,6 +5185,12 @@
"value": "Omschrijving"
}
],
+ "iQblZd": [
+ {
+ "type": 0,
+ "value": "Variables that are already included."
+ }
+ ],
"iX0YPY": [
{
"options": {
@@ -5697,6 +5751,12 @@
"value": "Huisnummer"
}
],
+ "mfD7J5": [
+ {
+ "type": 0,
+ "value": "Name"
+ }
+ ],
"mpzdoT": [
{
"type": 0,
@@ -5727,6 +5787,12 @@
"value": "Indien aangevinkt, dan worden gegevens van kinderen opgehaald en ingesloten."
}
],
+ "nEg4dr": [
+ {
+ "type": 0,
+ "value": "Metadata:"
+ }
+ ],
"nFXYHB": [
{
"type": 0,
@@ -5889,6 +5955,12 @@
"value": "Het patroon van reguliere expressie waar de stad aan moet voldoen voor het formulier kan verstuurd worden."
}
],
+ "ow5LZk": [
+ {
+ "type": 0,
+ "value": "Variables to include in the data to be sent."
+ }
+ ],
"oxYXJX": [
{
"type": 0,
@@ -6093,12 +6165,6 @@
"value": "Dit sjabloon wordt geƫvalueerd met de inzendingsgegevens wanneer de betaling ontvangen is. De resulterende JSON wordt naar de Objecten-API gestuurd om (de betaalattributen van) het eerder aangemaakte object bij te werken."
}
],
- "qPiUic": [
- {
- "type": 0,
- "value": "Which service to send the data to"
- }
- ],
"qUYLVg": [
{
"type": 0,
@@ -6265,6 +6331,12 @@
"value": "(nog niet ingesteld)"
}
],
+ "sAfROS": [
+ {
+ "type": 0,
+ "value": "Metadata variables"
+ }
+ ],
"sCkGL9": [
{
"type": 0,
@@ -6311,6 +6383,12 @@
"value": " 3"
}
],
+ "sokfvf": [
+ {
+ "type": 0,
+ "value": "The service to send the data to."
+ }
+ ],
"sptpzv": [
{
"type": 0,
@@ -6481,6 +6559,12 @@
"value": "Aantal dagen dat een voltooide inzending bewaard blijft. Laat leeg om de waarde van de algemene configuratie te gebruiken."
}
],
+ "uUf7cu": [
+ {
+ "type": 0,
+ "value": "Path relative to the Service API root."
+ }
+ ],
"uVVO4b": [
{
"type": 0,
diff --git a/src/openforms/js/components/admin/form_design/RegistrationFields.stories.js b/src/openforms/js/components/admin/form_design/RegistrationFields.stories.js
index bdd11f7084..3c545a2f7f 100644
--- a/src/openforms/js/components/admin/form_design/RegistrationFields.stories.js
+++ b/src/openforms/js/components/admin/form_design/RegistrationFields.stories.js
@@ -574,6 +574,60 @@ export default {
},
],
},
+ {
+ pluginIdentifier: 'json_dump',
+ pluginVerboseName: 'JSON Dump',
+ pluginVariables: [
+ {
+ form: null,
+ formDefinition: null,
+ name: 'Public reference',
+ key: 'public_reference',
+ source: '',
+ serviceFetchConfiguration: null,
+ prefillPlugin: '',
+ prefillAttribute: '',
+ prefillIdentifierRole: 'main',
+ prefillOptions: {},
+ dataType: 'string',
+ dataFormat: '',
+ isSensitiveData: false,
+ initialValue: null,
+ },
+ {
+ form: null,
+ formDefinition: null,
+ name: 'Form version',
+ key: 'form_version',
+ source: '',
+ serviceFetchConfiguration: null,
+ prefillPlugin: '',
+ prefillAttribute: '',
+ prefillIdentifierRole: 'main',
+ prefillOptions: {},
+ dataType: 'string',
+ dataFormat: '',
+ isSensitiveData: false,
+ initialValue: null,
+ },
+ {
+ form: null,
+ formDefinition: null,
+ name: 'Registration timestamp',
+ key: 'registration_timestamp',
+ source: '',
+ serviceFetchConfiguration: null,
+ prefillPlugin: '',
+ prefillAttribute: '',
+ prefillIdentifierRole: 'main',
+ prefillOptions: {},
+ dataType: 'datetime',
+ dataFormat: '',
+ isSensitiveData: false,
+ initialValue: null,
+ },
+ ],
+ },
],
},
parameters: {
@@ -771,6 +825,8 @@ export const ConfiguredBackends = {
service: 1,
path: 'example/endpoint',
variables: [],
+ fixedMetadataVariables: [],
+ additionalMetadataVariables: [],
},
},
],
@@ -1030,6 +1086,8 @@ export const JSONDump = {
service: 1,
path: 'example/endpoint',
variables: [],
+ fixedMetadataVariables: ['form_name', 'form_version', 'public_reference'],
+ additionalMetadataVariables: ['auth_bsn'],
},
},
],
@@ -1089,7 +1147,23 @@ export const JSONDump = {
formDefinition: null,
name: 'BSN',
key: 'auth_bsn',
- source: 'static',
+ source: '',
+ prefillPlugin: '',
+ prefillAttribute: '',
+ prefillIdentifierRole: '',
+ prefillOptions: {},
+ dataType: 'string',
+ dataFormat: '',
+ isSensitiveData: false,
+ serviceFetchConfiguration: undefined,
+ initialValue: '',
+ },
+ {
+ form: null,
+ formDefinition: null,
+ name: 'Form name',
+ key: 'form_name',
+ source: '',
prefillPlugin: '',
prefillAttribute: '',
prefillIdentifierRole: '',
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpOptionsForm.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpOptionsForm.js
index 987e8e09c0..6449d1fd3f 100644
--- a/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpOptionsForm.js
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpOptionsForm.js
@@ -11,7 +11,13 @@ import {
} from 'components/admin/forms/ValidationErrors';
import {getChoicesFromSchema} from 'utils/json-schema';
-import {Path, ServiceSelect, Variables} from './fields';
+import {
+ AdditionalMetadataVariables,
+ FixedMetadataVariables,
+ Path,
+ ServiceSelect,
+ Variables,
+} from './fields';
const JSONDumpOptionsForm = ({name, label, schema, formData, onChange}) => {
const validationErrors = useContext(ValidationErrorContext);
@@ -38,6 +44,8 @@ const JSONDumpOptionsForm = ({name, label, schema, formData, onChange}) => {
service: null,
path: '',
variables: [],
+ fixedMetadataVariables: [],
+ additionalMetadataVariables: [],
...formData,
}}
onSubmit={values => onChange({formData: values})}
@@ -49,6 +57,20 @@ const JSONDumpOptionsForm = ({name, label, schema, formData, onChange}) => {
+
+
+ }
+ collapsible
+ initialCollapsed
+ >
+
+
+
);
@@ -69,6 +91,8 @@ JSONDumpOptionsForm.propTypes = {
service: PropTypes.number,
path: PropTypes.string,
variables: PropTypes.arrayOf(PropTypes.string),
+ fixedMetadataVariables: PropTypes.arrayOf(PropTypes.string),
+ additionalMetadataVariables: PropTypes.arrayOf(PropTypes.string),
}),
onChange: PropTypes.func.isRequired,
};
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpSummaryHandler.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpSummaryHandler.js
index 0c74f9e4d8..71c7627efe 100644
--- a/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpSummaryHandler.js
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpSummaryHandler.js
@@ -1,12 +1,30 @@
import PropTypes from 'prop-types';
import React from 'react';
+import {FormattedMessage} from 'react-intl';
import {IconNo, IconYes} from 'components/admin/BooleanIcons';
const JSONDumpSummaryHandler = ({variable, backendOptions}) => {
- const isIncluded = backendOptions.variables.includes(variable.key);
+ const isIncludedInVariables = backendOptions.variables.includes(variable.key);
+ const isIncludedInMetadata =
+ backendOptions.fixedMetadataVariables.includes(variable.key) ||
+ backendOptions.additionalMetadataVariables.includes(variable.key);
- return isIncluded ? : ;
+ return (
+ <>
+
+ {isIncludedInVariables ? : }
+
+
+ {isIncludedInMetadata ? : }
+ >
+ );
};
JSONDumpSummaryHandler.propTypes = {
@@ -15,6 +33,8 @@ JSONDumpSummaryHandler.propTypes = {
}).isRequired,
backendOptions: PropTypes.shape({
variables: PropTypes.arrayOf(PropTypes.string).isRequired,
+ fixedMetadataVariables: PropTypes.arrayOf(PropTypes.string).isRequired,
+ additionalMetadataVariables: PropTypes.arrayOf(PropTypes.string).isRequired,
}).isRequired,
};
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpVariableConfigurationEditor.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpVariableConfigurationEditor.js
index 75f5b4077c..955b721e07 100644
--- a/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpVariableConfigurationEditor.js
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/JSONDumpVariableConfigurationEditor.js
@@ -3,45 +3,82 @@ import PropTypes from 'prop-types';
import React from 'react';
import {FormattedMessage} from 'react-intl';
+import {VARIABLE_SOURCES} from 'components/admin/form_design/variables/constants';
+import {getVariableSource} from 'components/admin/form_design/variables/utils';
import Field from 'components/admin/forms/Field';
import FormRow from 'components/admin/forms/FormRow';
import {Checkbox} from 'components/admin/forms/Inputs';
const JSONDumpVariableConfigurationEditor = ({variable}) => {
const {
- values: {variables = []},
+ values: {variables = [], additionalMetadataVariables = [], fixedMetadataVariables = []},
setFieldValue,
} = useFormikContext();
const isIncluded = variables.includes(variable.key);
+ const isRequiredInMetadata = fixedMetadataVariables.includes(variable.key);
+ const isInAdditionalMetadata = additionalMetadataVariables.includes(variable.key);
return (
-
-
-
- }
- helpText={
-
- }
- checked={isIncluded}
- onChange={event => {
- const shouldBeIncluded = event.target.checked;
- const newVariables = shouldBeIncluded
- ? [...variables, variable.key] // add the variable to the array
- : variables.filter(key => key !== variable.key); // remove the variable from the array
- setFieldValue('variables', newVariables);
- }}
- />
-
-
+ <>
+
+
+
+ }
+ helpText={
+
+ }
+ checked={isIncluded}
+ onChange={event => {
+ const shouldBeIncluded = event.target.checked;
+ const newVariables = shouldBeIncluded
+ ? [...variables, variable.key] // add the variable to the array
+ : variables.filter(key => key !== variable.key); // remove the variable from the array
+ setFieldValue('variables', newVariables);
+ }}
+ />
+
+
+
+
+
+
+ }
+ helpText={
+
+ }
+ checked={isInAdditionalMetadata || isRequiredInMetadata}
+ onChange={event => {
+ const shouldBeIncluded = event.target.checked;
+ const newVariables = shouldBeIncluded
+ ? [...additionalMetadataVariables, variable.key] // add the variable to the array
+ : additionalMetadataVariables.filter(key => key !== variable.key); // remove the variable from the array
+ setFieldValue('additionalMetadataVariables', newVariables);
+ }}
+ disabled={
+ isRequiredInMetadata || getVariableSource(variable) !== VARIABLE_SOURCES.static
+ } // disable if it is required or the variable is not a static variable
+ />
+
+
+ >
);
};
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/constants.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/constants.js
new file mode 100644
index 0000000000..516c66e26f
--- /dev/null
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/constants.js
@@ -0,0 +1 @@
+export const PLUGIN_ID = 'json_dump';
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/MetadataVariables.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/MetadataVariables.js
new file mode 100644
index 0000000000..41fd79e760
--- /dev/null
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/MetadataVariables.js
@@ -0,0 +1,119 @@
+import {useField} from 'formik';
+import React, {useContext} from 'react';
+import {FormattedMessage} from 'react-intl';
+
+import {FormContext} from 'components/admin/form_design/Context';
+import {VARIABLE_SOURCES} from 'components/admin/form_design/variables/constants';
+import {getVariableSource} from 'components/admin/form_design/variables/utils';
+import Field from 'components/admin/forms/Field';
+import FormRow from 'components/admin/forms/FormRow';
+import VariableSelection from 'components/admin/forms/VariableSelection';
+import {ChangelistColumn, ChangelistTable} from 'components/admin/tables';
+
+import {PLUGIN_ID} from '../constants';
+
+const FixedMetadataVariables = () => {
+ const [, {value}] = useField('fixedMetadataVariables');
+ const {staticVariables, registrationPluginsVariables} = useContext(FormContext);
+
+ // Create table data
+ const jsonDumpVariables = registrationPluginsVariables.find(
+ v => v.pluginIdentifier === PLUGIN_ID
+ ).pluginVariables;
+ const relevantVariables = [
+ ...staticVariables.map(v => ({
+ ...v,
+ source: (
+
+ ),
+ })),
+ ...jsonDumpVariables.map(v => ({
+ ...v,
+ source: (
+
+ ),
+ })),
+ ].filter(v => value.includes(v.key));
+
+ return (
+
+
+ }
+ helpText={
+
+ }
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+const AdditionalMetadataVariables = () => {
+ const [fieldProps] = useField('additionalMetadataVariables');
+ const [, {value}] = useField('fixedMetadataVariables');
+
+ return (
+
+
+ }
+ helpText={
+
+ }
+ noManageChildProps
+ >
+
+ getVariableSource(variable) === VARIABLE_SOURCES.static && !value.includes(variable.key)
+ } // Only show static variables and variables which are not already required
+ />
+
+
+ );
+};
+
+export {AdditionalMetadataVariables, FixedMetadataVariables};
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/Path.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/Path.js
index 0f7ca403ff..225ef5ed56 100644
--- a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/Path.js
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/Path.js
@@ -21,7 +21,7 @@ const Path = () => {
helpText={
}
>
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/ServiceSelect.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/ServiceSelect.js
index 6240cffdc4..2939338258 100644
--- a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/ServiceSelect.js
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/ServiceSelect.js
@@ -20,7 +20,7 @@ const ServiceSelect = ({options}) => {
helpText={
}
required
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/Variables.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/Variables.js
index b06998a6df..3443561ca6 100644
--- a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/Variables.js
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/Variables.js
@@ -22,7 +22,7 @@ const Variables = () => {
helpText={
}
required
diff --git a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/index.js b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/index.js
index ab0ba696a9..d86d1f2872 100644
--- a/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/index.js
+++ b/src/openforms/js/components/admin/form_design/registrations/json_dump/fields/index.js
@@ -1,5 +1,6 @@
+import {AdditionalMetadataVariables, FixedMetadataVariables} from './MetadataVariables';
import Path from './Path';
import ServiceSelect from './ServiceSelect';
import Variables from './Variables';
-export {Path, ServiceSelect, Variables};
+export {AdditionalMetadataVariables, FixedMetadataVariables, Path, ServiceSelect, Variables};
diff --git a/src/openforms/js/components/admin/form_design/variables/VariablesEditor.stories.js b/src/openforms/js/components/admin/form_design/variables/VariablesEditor.stories.js
index e37bb60a31..dd539dadc4 100644
--- a/src/openforms/js/components/admin/form_design/variables/VariablesEditor.stories.js
+++ b/src/openforms/js/components/admin/form_design/variables/VariablesEditor.stories.js
@@ -664,10 +664,35 @@ export const WithJSONDumpRegistrationBackend = {
options: {
service: 2,
path: 'test',
- variables: ['aSingleFile', 'now'],
+ variables: ['aSingleFile'],
+ fixedMetadataVariables: ['public_reference'],
+ additionalMetadataVariables: ['now'],
},
},
],
+ registrationPluginsVariables: [
+ {
+ pluginIdentifier: 'json_dump',
+ pluginVerboseName: 'JSON dump registration',
+ pluginVariables: [
+ {
+ form: null,
+ formDefinition: null,
+ name: 'Public reference',
+ key: 'public_reference',
+ source: '',
+ prefillPlugin: '',
+ prefillAttribute: '',
+ prefillIdentifierRole: 'main',
+ dataType: 'string',
+ dataFormat: '',
+ isSensitiveData: false,
+ serviceFetchConfiguration: undefined,
+ initialValue: '',
+ },
+ ],
+ },
+ ],
},
play: async ({canvasElement, step}) => {
const canvas = within(canvasElement);
@@ -675,36 +700,57 @@ export const WithJSONDumpRegistrationBackend = {
const editIcons = canvas.getAllByTitle('Registratie-instellingen bewerken');
await expect(editIcons).toHaveLength(3);
- await step('formioComponent checkbox unchecked', async () => {
+ await step('formioComponent checkboxes unchecked', async () => {
await userEvent.click(editIcons[0]);
- const checkbox = await canvas.findByRole('checkbox');
- await expect(checkbox).not.toBeChecked();
+ const checkboxes = await canvas.getAllByRole('checkbox');
+ await expect(checkboxes[0]).not.toBeChecked();
+ await expect(checkboxes[1]).not.toBeChecked();
+ await expect(checkboxes[1]).toBeDisabled();
const saveButton = canvas.getByRole('button', {name: 'Opslaan'});
await userEvent.click(saveButton);
});
- await step('aSingleFile checkbox checked', async () => {
+ await step('aSingleFile values checkbox checked and metadata checkbox unchecked', async () => {
await userEvent.click(editIcons[1]);
- const checkbox = await canvas.findByRole('checkbox');
- await expect(checkbox).toBeChecked();
+ const checkboxes = await canvas.findAllByRole('checkbox');
+ await expect(checkboxes[0]).toBeChecked();
+ await expect(checkboxes[1]).not.toBeChecked();
const saveButton = canvas.getByRole('button', {name: 'Opslaan'});
await userEvent.click(saveButton);
});
- await step('now checkbox checked', async () => {
+ await step('now values checkbox unchecked and metadata checkbox checked', async () => {
const staticVariables = canvas.getByRole('tab', {name: /Vaste variabelen/});
await userEvent.click(staticVariables);
const editIcon = canvas.getByTitle('Registratie-instellingen bewerken');
await userEvent.click(editIcon);
- const checkbox = await canvas.findByRole('checkbox');
- await expect(checkbox).toBeChecked();
+ const checkboxes = await canvas.findAllByRole('checkbox');
+ await expect(checkboxes[0]).not.toBeChecked();
+ await expect(checkboxes[1]).toBeChecked();
+ await expect(checkboxes[1]).not.toBeDisabled();
});
+
+ await step(
+ 'public_registration values checkbox unchecked and metadata checkbox checked',
+ async () => {
+ const registrationVariables = canvas.getByRole('tab', {name: /Registratie/});
+ await userEvent.click(registrationVariables);
+
+ const editIcon = canvas.getByTitle('Registratie-instellingen bewerken');
+ await userEvent.click(editIcon);
+
+ const checkboxes = await canvas.findAllByRole('checkbox');
+ await expect(checkboxes[0]).not.toBeChecked();
+ await expect(checkboxes[1]).toBeChecked();
+ await expect(checkboxes[1]).toBeDisabled();
+ }
+ );
},
};
diff --git a/src/openforms/js/components/admin/form_design/variables/utils.js b/src/openforms/js/components/admin/form_design/variables/utils.js
index c4ec01238a..dc922aaf68 100644
--- a/src/openforms/js/components/admin/form_design/variables/utils.js
+++ b/src/openforms/js/components/admin/form_design/variables/utils.js
@@ -284,6 +284,7 @@ export {
getFormVariables,
getComponentDatatype,
checkForDuplicateKeys,
+ getVariableSource,
getVariableSourceLabel,
groupVariablesBySource,
variableHasErrors,
diff --git a/src/openforms/js/lang/en.json b/src/openforms/js/lang/en.json
index 20a972fe60..60c533e279 100644
--- a/src/openforms/js/lang/en.json
+++ b/src/openforms/js/lang/en.json
@@ -249,6 +249,11 @@
"description": "Manage process vars component help text",
"originalDefault": "The value of the selected field will be the process variable value."
},
+ "5EOSwM": {
+ "defaultMessage": "Additional",
+ "description": "JSON registration options 'additionalMetadataVariables' label",
+ "originalDefault": "Additional"
+ },
"5JNnFB": {
"defaultMessage": "Switching to the legacy registration options will remove the existing variables mapping. Are you sure you want to continue?",
"description": "Objects API registration backend: v1 switch warning message",
@@ -599,6 +604,11 @@
"description": "data type boolean",
"originalDefault": "Boolean"
},
+ "BiKRJT": {
+ "defaultMessage": "Key",
+ "description": "Fixed metadata table name key title",
+ "originalDefault": "Key"
+ },
"Bin/vM": {
"defaultMessage": "Save changes",
"description": "Text on button in modal to save design token values",
@@ -659,11 +669,6 @@
"description": "\"literal\" operand type",
"originalDefault": "value"
},
- "CZ774U": {
- "defaultMessage": "Which variables to include in the data to be sent",
- "description": "JSON registration options 'variables' helpText",
- "originalDefault": "Which variables to include in the data to be sent"
- },
"CiaAYL": {
"defaultMessage": "Select the allowed authentication plugins to log in at the start of the form.",
"description": "Auth plugin field help text",
@@ -679,6 +684,11 @@
"description": "Form submissionAllowed field label",
"originalDefault": "Submission allowed"
},
+ "Cz+O0n": {
+ "defaultMessage": "Source",
+ "description": "Fixed metadata table source title",
+ "originalDefault": "Source"
+ },
"D6NRQk": {
"defaultMessage": "Detected problems in {count} logic rule(s).",
"description": "Logic tab warning icon message",
@@ -1059,11 +1069,6 @@
"description": "Objects API prefill mappings fieldset title",
"originalDefault": "Mappings"
},
- "Ibejpf": {
- "defaultMessage": "Path relative to the Service API root",
- "description": "JSON registration options 'path' helpText",
- "originalDefault": "Path relative to the Service API root"
- },
"Igt0Rc": {
"defaultMessage": "Skip ownership check",
"description": "Objects API registration: skipOwnershipCheck label",
@@ -1139,6 +1144,11 @@
"description": "Minimal LoA override help text",
"originalDefault": "Override the minimum Level of Assurance. This is not supported by all authentication plugins."
},
+ "JfgATN": {
+ "defaultMessage": "Additional variables to include.",
+ "description": "JSON registration options 'additionalMetadataVariables' helpText",
+ "originalDefault": "Additional variables to include."
+ },
"JhdlEg": {
"defaultMessage": "There are co-sign components inside repeating groups. This is not supported.",
"description": "Cosign components in repeating group warning message",
@@ -1174,6 +1184,11 @@
"description": "Confirmation Email Content label",
"originalDefault": "Content"
},
+ "KMTsJc": {
+ "defaultMessage": "Static",
+ "description": "'Static' source label for fixed metadata variables table",
+ "originalDefault": "Static"
+ },
"KYTAJZ": {
"defaultMessage": "(checked for every step)",
"description": "'Trigger from step' information for when unset",
@@ -1404,6 +1419,11 @@
"description": "Session expiry warning (in modal)",
"originalDefault": "Your session is about to expire {delta}. Extend your session if you wish to continue."
},
+ "Od+jm6": {
+ "defaultMessage": "Values:",
+ "description": "Label indicating the 'values' part of the data",
+ "originalDefault": "Values:"
+ },
"Oi+DV0": {
"defaultMessage": "{attr}
from {plugin}
(of the {role})",
"description": "Prefill configuration summary",
@@ -1794,6 +1814,11 @@
"description": "Form list 'active' column header",
"originalDefault": "Active"
},
+ "X+NeMd": {
+ "defaultMessage": "Include variable in metadata",
+ "description": "'Include variable in metadata' checkbox label",
+ "originalDefault": "Include variable in metadata"
+ },
"X18/UP": {
"defaultMessage": "Owner identifier",
"description": "Objects API registration: authAttributePath label",
@@ -1844,6 +1869,11 @@
"description": "Objects registration variable mapping, addressNL component: 'options.houseNumber schema target' label",
"originalDefault": "House number Schema target"
},
+ "Xpw7Gk": {
+ "defaultMessage": "Whether to include this variable in the metadata to be sent.",
+ "description": "'Include variable in metadata' checkbox help text",
+ "originalDefault": "Whether to include this variable in the metadata to be sent."
+ },
"XyDeaD": {
"defaultMessage": "Variables",
"description": "JSON registration options 'variables' label",
@@ -2014,6 +2044,11 @@
"description": "Objects API registration options 'Objecttype' label",
"originalDefault": "Objecttype"
},
+ "bmUuAH": {
+ "defaultMessage": "Fixed",
+ "description": "JSON registration options 'fixedMetadataVariables' label",
+ "originalDefault": "Fixed"
+ },
"bmlODS": {
"defaultMessage": "Identifier role",
"description": "Variable prefill identifier role label",
@@ -2384,6 +2419,11 @@
"description": "User defined variable deletion confirm message",
"originalDefault": "Are you sure you want to delete this variable?"
},
+ "hfeO2r": {
+ "defaultMessage": "Registration",
+ "description": "'Registration' source label for fixed metadata variables table",
+ "originalDefault": "Registration"
+ },
"hhoWxC": {
"defaultMessage": "If left blank, then the most recent version is used.",
"description": "DMN action: definition version field help text",
@@ -2419,6 +2459,11 @@
"description": "Objects API registration options \"Attachment informatieobjecttype\" label",
"originalDefault": "Attachment informatieobjecttype"
},
+ "iQblZd": {
+ "defaultMessage": "Variables that are already included.",
+ "description": "JSON registration options 'fixedMetadataVariables' helpText",
+ "originalDefault": "Variables that are already included."
+ },
"iXJKU7": {
"defaultMessage": "Component variables",
"description": "Variable source group label for component variables",
@@ -2639,6 +2684,11 @@
"description": "JSON variable type \"Form field\" representation",
"originalDefault": "Form field"
},
+ "mfD7J5": {
+ "defaultMessage": "Name",
+ "description": "Fixed metadata table name title",
+ "originalDefault": "Name"
+ },
"myvtu0": {
"defaultMessage": "Manage process variables",
"description": "Open manage camunda process vars modal button",
@@ -2649,6 +2699,11 @@
"description": "Camunda 'process definition version' label",
"originalDefault": "Version"
},
+ "nEg4dr": {
+ "defaultMessage": "Metadata:",
+ "description": "Label indicating the 'metadata' part of the data",
+ "originalDefault": "Metadata:"
+ },
"nFXYHB": {
"defaultMessage": "When the form should be deactivated.",
"description": "Form deactivation field help text",
@@ -2734,6 +2789,11 @@
"description": "Objects API prefill options 'Objecttype' helpText",
"originalDefault": "The prefill values will be taken from an object of the selected type."
},
+ "ow5LZk": {
+ "defaultMessage": "Variables to include in the data to be sent.",
+ "description": "JSON registration options 'variables' helpText",
+ "originalDefault": "Variables to include in the data to be sent."
+ },
"oxYXJX": {
"defaultMessage": "How successful submissions of this form will be removed after the limit. Leave blank to use value in General Configuration.",
"description": "Successful Submissions Removal Method help text",
@@ -2814,11 +2874,6 @@
"description": "Legacy objects API registration options: 'paymentStatusUpdateJson' helpText",
"originalDefault": "This template is evaluated with the submission data when the payment is received. The resulting JSON is sent to the objects API to update (the payment fields of) the earlier created object."
},
- "qPiUic": {
- "defaultMessage": "Which service to send the data to",
- "description": "JSON registration options 'serviceSelect' helpText",
- "originalDefault": "Which service to send the data to"
- },
"qUYLVg": {
"defaultMessage": "Product & payment",
"description": "Product & payments tab title",
@@ -2914,6 +2969,11 @@
"description": "DMN evaluation not configured yet message",
"originalDefault": "(not configured yet)"
},
+ "sAfROS": {
+ "defaultMessage": "Metadata variables",
+ "description": "Metadata variables fieldset title",
+ "originalDefault": "Metadata variables"
+ },
"sCkGL9": {
"defaultMessage": "invalid output mapping(s)",
"description": "Warning message: DMN output mapping problems detected",
@@ -2929,6 +2989,11 @@
"description": "Email registration options 'attachFilesToEmail' helpText",
"originalDefault": "Enable to attach file uploads to the registration email. If set, this overrides the global default. Form designers should take special care to ensure that the total file upload sizes do not exceed the email size limit."
},
+ "sokfvf": {
+ "defaultMessage": "The service to send the data to.",
+ "description": "JSON registration options 'serviceSelect' helpText",
+ "originalDefault": "The service to send the data to."
+ },
"sptpzv": {
"defaultMessage": "Switching to the new registration options will remove the existing JSON templates. You will also not be able to save the form until the variables are correctly mapped. Are you sure you want to continue?",
"description": "Objects API registration backend: v2 switch warning message",
@@ -3014,6 +3079,11 @@
"description": "Successful Submissions Removal Limit help text",
"originalDefault": "Amount of days successful submissions of this form will remain before being removed. Leave blank to use value in General Configuration."
},
+ "uUf7cu": {
+ "defaultMessage": "Path relative to the Service API root.",
+ "description": "JSON registration options 'path' helpText",
+ "originalDefault": "Path relative to the Service API root."
+ },
"uiliGe": {
"defaultMessage": "The logic rules you set up here are executed in the order that they are defined. Please consult the manual for more information.",
"description": "Logic rules introduction/explanation",
diff --git a/src/openforms/js/lang/nl.json b/src/openforms/js/lang/nl.json
index d2a973cf30..5e954c01f8 100644
--- a/src/openforms/js/lang/nl.json
+++ b/src/openforms/js/lang/nl.json
@@ -251,6 +251,11 @@
"description": "Manage process vars component help text",
"originalDefault": "The value of the selected field will be the process variable value."
},
+ "5EOSwM": {
+ "defaultMessage": "Additional",
+ "description": "JSON registration options 'additionalMetadataVariables' label",
+ "originalDefault": "Additional"
+ },
"5JNnFB": {
"defaultMessage": "Let op! Teruggaan naar het oude configuratieformaat verwijdert de ingestelde variabelekoppelingen. Ben je zeker dat je wil teruggaan?",
"description": "Objects API registration backend: v1 switch warning message",
@@ -604,6 +609,11 @@
"description": "data type boolean",
"originalDefault": "Boolean"
},
+ "BiKRJT": {
+ "defaultMessage": "Key",
+ "description": "Fixed metadata table name key title",
+ "originalDefault": "Key"
+ },
"Bin/vM": {
"defaultMessage": "Opslaan",
"description": "Text on button in modal to save design token values",
@@ -665,11 +675,6 @@
"description": "\"literal\" operand type",
"originalDefault": "value"
},
- "CZ774U": {
- "defaultMessage": "Which variables to include in the data to be sent",
- "description": "JSON registration options 'variables' helpText",
- "originalDefault": "Which variables to include in the data to be sent"
- },
"CiaAYL": {
"defaultMessage": "Selecteer de toegestane authenticatie-plugins om in te loggen aan het begin van het formulier.",
"description": "Auth plugin field help text",
@@ -685,6 +690,11 @@
"description": "Form submissionAllowed field label",
"originalDefault": "Submission allowed"
},
+ "Cz+O0n": {
+ "defaultMessage": "Source",
+ "description": "Fixed metadata table source title",
+ "originalDefault": "Source"
+ },
"D6NRQk": {
"defaultMessage": "{count, plural, one {1 logicaregel met problemen.} other {{count, number} logicaregels met problemen.}}",
"description": "Logic tab warning icon message",
@@ -1068,11 +1078,6 @@
"description": "Objects API prefill mappings fieldset title",
"originalDefault": "Mappings"
},
- "Ibejpf": {
- "defaultMessage": "Path relative to the Service API root",
- "description": "JSON registration options 'path' helpText",
- "originalDefault": "Path relative to the Service API root"
- },
"Igt0Rc": {
"defaultMessage": "Sla eigenaarcontrole over",
"description": "Objects API registration: skipOwnershipCheck label",
@@ -1148,6 +1153,11 @@
"description": "Minimal LoA override help text",
"originalDefault": "Override the minimum Level of Assurance. This is not supported by all authentication plugins."
},
+ "JfgATN": {
+ "defaultMessage": "Additional variables to include.",
+ "description": "JSON registration options 'additionalMetadataVariables' helpText",
+ "originalDefault": "Additional variables to include."
+ },
"JhdlEg": {
"defaultMessage": "Er zijn mede-ondertekencomponenten gevonden binnen een herhalende groep. Dit is niet ondersteund.",
"description": "Cosign components in repeating group warning message",
@@ -1183,6 +1193,11 @@
"description": "Confirmation Email Content label",
"originalDefault": "Content"
},
+ "KMTsJc": {
+ "defaultMessage": "Static",
+ "description": "'Static' source label for fixed metadata variables table",
+ "originalDefault": "Static"
+ },
"KYTAJZ": {
"defaultMessage": "(actief binnen elke stap)",
"description": "'Trigger from step' information for when unset",
@@ -1415,6 +1430,11 @@
"description": "Session expiry warning (in modal)",
"originalDefault": "Your session is about to expire {delta}. Extend your session if you wish to continue."
},
+ "Od+jm6": {
+ "defaultMessage": "Values:",
+ "description": "Label indicating the 'values' part of the data",
+ "originalDefault": "Values:"
+ },
"Oi+DV0": {
"defaultMessage": "{attr}
uit {plugin}
(van de {role})",
"description": "Prefill configuration summary",
@@ -1812,6 +1832,11 @@
"description": "Form list 'active' column header",
"originalDefault": "Active"
},
+ "X+NeMd": {
+ "defaultMessage": "Include variable in metadata",
+ "description": "'Include variable in metadata' checkbox label",
+ "originalDefault": "Include variable in metadata"
+ },
"X18/UP": {
"defaultMessage": "Identificatie-attribuut",
"description": "Objects API registration: authAttributePath label",
@@ -1862,6 +1887,11 @@
"description": "Objects registration variable mapping, addressNL component: 'options.houseNumber schema target' label",
"originalDefault": "House number Schema target"
},
+ "Xpw7Gk": {
+ "defaultMessage": "Whether to include this variable in the metadata to be sent.",
+ "description": "'Include variable in metadata' checkbox help text",
+ "originalDefault": "Whether to include this variable in the metadata to be sent."
+ },
"XyDeaD": {
"defaultMessage": "Variables",
"description": "JSON registration options 'variables' label",
@@ -2033,6 +2063,11 @@
"isTranslated": true,
"originalDefault": "Objecttype"
},
+ "bmUuAH": {
+ "defaultMessage": "Fixed",
+ "description": "JSON registration options 'fixedMetadataVariables' label",
+ "originalDefault": "Fixed"
+ },
"bmlODS": {
"defaultMessage": "Bronhouder",
"description": "Variable prefill identifier role label",
@@ -2404,6 +2439,11 @@
"description": "User defined variable deletion confirm message",
"originalDefault": "Are you sure you want to delete this variable?"
},
+ "hfeO2r": {
+ "defaultMessage": "Registration",
+ "description": "'Registration' source label for fixed metadata variables table",
+ "originalDefault": "Registration"
+ },
"hhoWxC": {
"defaultMessage": "Als je dit leeg laat, dan wordt de nieuwste versie gebruikt.",
"description": "DMN action: definition version field help text",
@@ -2440,6 +2480,11 @@
"description": "Objects API registration options \"Attachment informatieobjecttype\" label",
"originalDefault": "Attachment informatieobjecttype"
},
+ "iQblZd": {
+ "defaultMessage": "Variables that are already included.",
+ "description": "JSON registration options 'fixedMetadataVariables' helpText",
+ "originalDefault": "Variables that are already included."
+ },
"iXJKU7": {
"defaultMessage": "Component",
"description": "Variable source group label for component variables",
@@ -2660,6 +2705,11 @@
"description": "JSON variable type \"Form field\" representation",
"originalDefault": "Form field"
},
+ "mfD7J5": {
+ "defaultMessage": "Name",
+ "description": "Fixed metadata table name title",
+ "originalDefault": "Name"
+ },
"myvtu0": {
"defaultMessage": "Beheer procesvariabelen",
"description": "Open manage camunda process vars modal button",
@@ -2670,6 +2720,11 @@
"description": "Camunda 'process definition version' label",
"originalDefault": "Version"
},
+ "nEg4dr": {
+ "defaultMessage": "Metadata:",
+ "description": "Label indicating the 'metadata' part of the data",
+ "originalDefault": "Metadata:"
+ },
"nFXYHB": {
"defaultMessage": "Datum en tijdstip waarop het formulier gedeactiveerd moet worden.",
"description": "Form deactivation field help text",
@@ -2755,6 +2810,11 @@
"description": "Objects API prefill options 'Objecttype' helpText",
"originalDefault": "The prefill values will be taken from an object of the selected type."
},
+ "ow5LZk": {
+ "defaultMessage": "Variables to include in the data to be sent.",
+ "description": "JSON registration options 'variables' helpText",
+ "originalDefault": "Variables to include in the data to be sent."
+ },
"oxYXJX": {
"defaultMessage": "Geeft aan hoe voltooide inzendingen worden opgeschoond na de bewaartermijn. Laat leeg om de waarde van de algemene configuratie te gebruiken.",
"description": "Successful Submissions Removal Method help text",
@@ -2835,11 +2895,6 @@
"description": "Legacy objects API registration options: 'paymentStatusUpdateJson' helpText",
"originalDefault": "This template is evaluated with the submission data when the payment is received. The resulting JSON is sent to the objects API to update (the payment fields of) the earlier created object."
},
- "qPiUic": {
- "defaultMessage": "Which service to send the data to",
- "description": "JSON registration options 'serviceSelect' helpText",
- "originalDefault": "Which service to send the data to"
- },
"qUYLVg": {
"defaultMessage": "Product en betaling",
"description": "Product & payments tab title",
@@ -2935,6 +2990,11 @@
"description": "DMN evaluation not configured yet message",
"originalDefault": "(not configured yet)"
},
+ "sAfROS": {
+ "defaultMessage": "Metadata variables",
+ "description": "Metadata variables fieldset title",
+ "originalDefault": "Metadata variables"
+ },
"sCkGL9": {
"defaultMessage": "ongeldige uitvoerparameters",
"description": "Warning message: DMN output mapping problems detected",
@@ -2950,6 +3010,11 @@
"description": "Email registration options 'attachFilesToEmail' helpText",
"originalDefault": "Enable to attach file uploads to the registration email. If set, this overrides the global default. Form designers should take special care to ensure that the total file upload sizes do not exceed the email size limit."
},
+ "sokfvf": {
+ "defaultMessage": "The service to send the data to.",
+ "description": "JSON registration options 'serviceSelect' helpText",
+ "originalDefault": "The service to send the data to."
+ },
"sptpzv": {
"defaultMessage": "Let op! Migreren naar het nieuwe configuratieformaat maakt de bestaande JSON-sjablonen leeg. Daarnaast kan je het formulier pas opslaan als alle verplichte variabelen goed gekoppeld zijn. Ben je zeker dat je wil migreren?",
"description": "Objects API registration backend: v2 switch warning message",
@@ -3035,6 +3100,11 @@
"description": "Successful Submissions Removal Limit help text",
"originalDefault": "Amount of days successful submissions of this form will remain before being removed. Leave blank to use value in General Configuration."
},
+ "uUf7cu": {
+ "defaultMessage": "Path relative to the Service API root.",
+ "description": "JSON registration options 'path' helpText",
+ "originalDefault": "Path relative to the Service API root."
+ },
"uiliGe": {
"defaultMessage": "De logicaregels die u hier definieert worden uitgevoerd in de volgorde zoals hier weergegeven. U vindt meer informatie in de handleiding.",
"description": "Logic rules introduction/explanation",
diff --git a/src/openforms/registrations/contrib/json_dump/config.py b/src/openforms/registrations/contrib/json_dump/config.py
index 724ec4e19b..a306953717 100644
--- a/src/openforms/registrations/contrib/json_dump/config.py
+++ b/src/openforms/registrations/contrib/json_dump/config.py
@@ -47,6 +47,36 @@ class JSONDumpOptionsSerializer(JsonSchemaSerializerMixin, serializers.Serialize
required=True,
min_length=1,
)
+ # Note: this field cannot be updated in the frontend, and is used as read-only.
+ # Adding a read_only=True argument to it, though, will make it not available in the
+ # backend options of the plugin, as they are not added to the validated_data
+ # property of the serializer.
+ fixed_metadata_variables = serializers.ListField(
+ child=FormioVariableKeyField(),
+ default=[
+ "public_reference",
+ "form_name",
+ "form_version",
+ "form_id",
+ "registration_timestamp",
+ "auth_type",
+ ],
+ label=_("Fixed metadata variable key list"),
+ help_text=_(
+ "A list of required variables to use in the metadata. These include "
+ "the registration variables of the JSON dump plugin."
+ ),
+ required=False,
+ )
+ # TODO: this list should be validated against the available FormVariable records
+ # that exist for the form.
+ additional_metadata_variables = serializers.ListField(
+ child=FormioVariableKeyField(),
+ label=_("Additional metadata variable key list"),
+ help_text=_("A list of additional variables to use in the metadata."),
+ required=False,
+ default=list,
+ )
class JSONDumpOptions(TypedDict):
@@ -60,3 +90,5 @@ class JSONDumpOptions(TypedDict):
service: Service
path: str
variables: list[str]
+ fixed_metadata_variables: list[str]
+ additional_metadata_variables: list[str]
diff --git a/src/openforms/registrations/contrib/json_dump/plugin.py b/src/openforms/registrations/contrib/json_dump/plugin.py
index c1ec1f7e2e..001838edb7 100644
--- a/src/openforms/registrations/contrib/json_dump/plugin.py
+++ b/src/openforms/registrations/contrib/json_dump/plugin.py
@@ -17,15 +17,18 @@
SelectComponent,
)
from openforms.forms.json_schema import generate_json_schema
+from openforms.forms.models import FormVariable
from openforms.submissions.models import Submission, SubmissionFileAttachment
from openforms.submissions.service import DataContainer
from openforms.typing import JSONObject
from openforms.utils.json_schema import to_multiple
from openforms.variables.constants import FormVariableSources
+from openforms.variables.service import get_static_variables
from ...base import BasePlugin # openforms.registrations.base
from ...registry import register # openforms.registrations.registry
from .config import JSONDumpOptions, JSONDumpOptionsSerializer
+from .registration_variables import register as variables_registry
@register("json_dump")
@@ -39,27 +42,53 @@ def register_submission(
) -> dict:
state = submission.load_submission_value_variables_state()
- # Generate values
# TODO: keys with a period (e.g. `foo.bar`) will currently not be added to the
# submission data. This will be fixed with issue 5041
+ # Get static values
+ static_values = state.get_static_data()
+ # Update static values with registration variables
+ static_values.update(state.get_static_data(other_registry=variables_registry))
+
all_values: JSONObject = {
- **state.get_static_data(),
+ **static_values,
**state.get_data(), # dynamic values from user input
}
+
+ # Values
values = {
key: value
for key, value in all_values.items()
if key in options["variables"]
}
-
- # Generate schema
- schema = generate_json_schema(submission.form, options["variables"])
-
- # Post-processing
- post_process(values, schema, submission)
+ values_schema = generate_json_schema(submission.form, options["variables"])
+ post_process(values, values_schema, submission)
+
+ # Metadata
+ # Note: as the metadata contains only static variables no post-processing is
+ # required.
+ metadata_variables = [
+ *options["fixed_metadata_variables"],
+ *options["additional_metadata_variables"],
+ ]
+ metadata = {
+ key: value for key, value in all_values.items() if key in metadata_variables
+ }
+ metadata_schema = generate_json_schema(
+ submission.form,
+ metadata_variables,
+ additional_variables_registry=variables_registry,
+ )
# Send to the service
- data = json.dumps({"values": values, "schema": schema}, cls=DjangoJSONEncoder)
+ data = json.dumps(
+ {
+ "values": values,
+ "values_schema": values_schema,
+ "metadata": metadata,
+ "metadata_schema": metadata_schema,
+ },
+ cls=DjangoJSONEncoder,
+ )
service = options["service"]
with build_client(service) as client:
if ".." in (path := options["path"]):
@@ -68,12 +97,17 @@ def register_submission(
result = client.post(path, json=data)
result.raise_for_status()
- return {"api_response": result.json()}
+ result_json = result.json() if result.content else ""
+
+ return {"api_response": result_json}
def check_config(self) -> None:
# Config checks are not really relevant for this plugin right now
pass
+ def get_variables(self) -> list[FormVariable]: # pragma: no cover
+ return get_static_variables(variables_registry=variables_registry)
+
def post_process(
values: JSONObject, schema: JSONObject, submission: Submission
diff --git a/src/openforms/registrations/contrib/json_dump/registration_variables.py b/src/openforms/registrations/contrib/json_dump/registration_variables.py
new file mode 100644
index 0000000000..e98890eecc
--- /dev/null
+++ b/src/openforms/registrations/contrib/json_dump/registration_variables.py
@@ -0,0 +1,62 @@
+from django.utils.translation import gettext_lazy as _
+
+from openforms.plugins.registry import BaseRegistry
+from openforms.submissions.models import Submission
+from openforms.typing import JSONObject
+from openforms.variables.base import BaseStaticVariable
+from openforms.variables.constants import FormVariableDataTypes
+from openforms.variables.static_variables.static_variables import Now
+
+
+class Registry(BaseRegistry[BaseStaticVariable]):
+ """
+ A registry for the JSON Dump registration variables.
+ """
+
+ module = "json_dump"
+
+
+register = Registry()
+"""The JSON Dump registration variables registry."""
+
+
+@register("public_reference")
+class PublicReference(BaseStaticVariable):
+ name = _("Public reference")
+ data_type = FormVariableDataTypes.string
+
+ def get_initial_value(self, submission: Submission | None = None) -> str:
+ if submission is None:
+ return ""
+ return submission.public_registration_reference
+
+ def as_json_schema(self) -> JSONObject:
+ return {"title": "Public reference", "type": "string"}
+
+
+@register("form_version")
+class FormVersion(BaseStaticVariable):
+ name = _("Form version")
+ data_type = FormVariableDataTypes.string
+
+ def get_initial_value(self, submission: Submission | None = None) -> str:
+ if submission is None:
+ return ""
+
+ form_version = submission.form.formversion_set.order_by("created").last()
+ return form_version.description if form_version else ""
+
+ def as_json_schema(self) -> JSONObject:
+ return {"title": "Form version", "type": "string"}
+
+
+@register("registration_timestamp")
+class RegistrationTimestamp(Now):
+ name = _("Registration timestamp")
+
+ def as_json_schema(self) -> JSONObject:
+ return {
+ "title": "Registration timestamp",
+ "type": "string",
+ "format": "date-time",
+ }
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.yaml
index 5e563723ea..29fd29bc5e 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.yaml
@@ -1,12 +1,14 @@
interactions:
- request:
body: '"{\"values\": {\"auth_bsn\": \"123456789\", \"firstName\": \"We Are\"},
- \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"auth_bsn\": {\"title\": \"BSN\", \"description\":
\"Uniquely identifies the authenticated person. This value follows the rules
for Dutch social security numbers.\", \"type\": \"string\", \"pattern\": \"^\\\\d{9}$\",
\"format\": \"nl-bsn\"}, \"firstName\": {\"title\": \"Firstname\", \"type\":
\"string\"}}, \"required\": [\"firstName\", \"auth_bsn\"], \"additionalProperties\":
+ false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
false}}"'
headers:
Accept:
@@ -14,11 +16,11 @@ interactions:
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDYsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.yOsfPLV9PeMal-KDFPCGvOKbOCO_3R_2SdMpSNFKj8s
Connection:
- keep-alive
Content-Length:
- - '575'
+ - '779'
Content-Type:
- application/json
User-Agent:
@@ -47,7 +49,7 @@ interactions:
Content-Type:
- text/html; charset=utf-8
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:46 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_metadata.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_metadata.yaml
new file mode 100644
index 0000000000..96398b2ed9
--- /dev/null
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_metadata.yaml
@@ -0,0 +1,66 @@
+interactions:
+- request:
+ body: '"{\"values\": {}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
+ false}, \"metadata\": {\"auth_type\": \"bsn\", \"public_reference\": \"OF-ABC123\",
+ \"form_version\": \"Version 1.0\", \"registration_timestamp\": \"2025-01-30T13:05:00Z\"},
+ \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {\"auth_type\": {\"title\": \"Authentication
+ type\", \"type\": \"string\", \"enum\": [\"bsn\", \"kvk\", \"pseudo\", \"employee_id\",
+ \"\"]}, \"public_reference\": {\"title\": \"Public reference\", \"type\": \"string\"},
+ \"form_version\": {\"title\": \"Form version\", \"type\": \"string\"}, \"registration_timestamp\":
+ {\"title\": \"Registration timestamp\", \"type\": \"string\", \"format\": \"date-time\"}},
+ \"required\": [\"form_version\", \"public_reference\", \"registration_timestamp\",
+ \"auth_type\"], \"additionalProperties\": false}}"'
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate, br
+ Authorization:
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNDIzMDAsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.47tdIv_fK-NTZyUtsVeNdZ4fAQvFuFvJcjYELMjeb8U
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '1027'
+ Content-Type:
+ - application/json
+ User-Agent:
+ - python-requests/2.32.2
+ method: POST
+ uri: http://localhost/json_plugin
+ response:
+ body:
+ string: "{\n \"data\": {\n \"metadata\": {\n \"auth_type\": \"bsn\",\n
+ \ \"form_version\": \"Version 1.0\",\n \"public_reference\": \"OF-ABC123\",\n
+ \ \"registration_timestamp\": \"2025-01-30T13:05:00Z\"\n },\n \"metadata_schema\":
+ {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ \ \"additionalProperties\": false,\n \"properties\": {\n \"auth_type\":
+ {\n \"enum\": [\n \"bsn\",\n \"kvk\",\n \"pseudo\",\n
+ \ \"employee_id\",\n \"\"\n ],\n \"title\":
+ \"Authentication type\",\n \"type\": \"string\"\n },\n \"form_version\":
+ {\n \"title\": \"Form version\",\n \"type\": \"string\"\n
+ \ },\n \"public_reference\": {\n \"title\": \"Public
+ reference\",\n \"type\": \"string\"\n },\n \"registration_timestamp\":
+ {\n \"format\": \"date-time\",\n \"title\": \"Registration
+ timestamp\",\n \"type\": \"string\"\n }\n },\n \"required\":
+ [\n \"form_version\",\n \"public_reference\",\n \"registration_timestamp\",\n
+ \ \"auth_type\"\n ],\n \"type\": \"object\"\n },\n \"values\":
+ {},\n \"values_schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ \ \"additionalProperties\": false,\n \"properties\": {},\n \"required\":
+ [],\n \"type\": \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
+ headers:
+ Connection:
+ - close
+ Content-Length:
+ - '1368'
+ Content-Type:
+ - application/json
+ Date:
+ - Thu, 30 Jan 2025 15:45:46 GMT
+ Server:
+ - Werkzeug/3.1.3 Python/3.12.8
+ status:
+ code: 201
+ message: CREATED
+version: 1
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml
index cba8df3f4c..93ec0e8f80 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml
@@ -2,23 +2,26 @@ interactions:
- request:
body: '"{\"values\": {\"file\": [{\"file_name\": \"file1.txt\", \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\"},
{\"file_name\": \"file2.txt\", \"content\": \"Q29udGVudCBleGFtcGxlIGlzIHRoaXMu\"}]},
- \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"file\": {\"title\": \"File\", \"type\":
\"array\", \"items\": {\"type\": \"object\", \"properties\": {\"file_name\":
{\"type\": \"string\"}, \"content\": {\"type\": \"string\", \"format\": \"base64\"}},
\"required\": [\"file_name\", \"content\"], \"additionalProperties\": false}}},
- \"required\": [\"file\"], \"additionalProperties\": false}}"'
+ \"required\": [\"file\"], \"additionalProperties\": false}, \"metadata\": {},
+ \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
+ false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDYsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.yOsfPLV9PeMal-KDFPCGvOKbOCO_3R_2SdMpSNFKj8s
Connection:
- keep-alive
Content-Length:
- - '654'
+ - '858'
Content-Type:
- application/json
User-Agent:
@@ -27,7 +30,14 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"file\": [\n {\n \"content\":
+ \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n \"file_name\": \"file1.txt\"\n
+ \ },\n {\n \"content\": \"Q29udGVudCBleGFtcGxlIGlzIHRoaXMu\",\n
+ \ \"file_name\": \"file2.txt\"\n }\n ]\n },\n \"values_schema\":
+ {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"file\":
{\n \"items\": {\n \"additionalProperties\": false,\n
\ \"properties\": {\n \"content\": {\n \"format\":
@@ -36,20 +46,17 @@ interactions:
\ \"required\": [\n \"file_name\",\n \"content\"\n
\ ],\n \"type\": \"object\"\n },\n \"title\":
\"File\",\n \"type\": \"array\"\n }\n },\n \"required\":
- [\n \"file\"\n ],\n \"type\": \"object\"\n },\n \"values\":
- {\n \"file\": [\n {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n
- \ \"file_name\": \"file1.txt\"\n },\n {\n \"content\":
- \"Q29udGVudCBleGFtcGxlIGlzIHRoaXMu\",\n \"file_name\": \"file2.txt\"\n
- \ }\n ]\n }\n },\n \"message\": \"Data received\"\n}\n"
+ [\n \"file\"\n ],\n \"type\": \"object\"\n }\n },\n \"message\":
+ \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '1057'
+ - '1287'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:46 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_nested_component_key.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_nested_component_key.yaml
index 5eafc1e694..1f85ee5b1b 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_nested_component_key.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_nested_component_key.yaml
@@ -1,8 +1,10 @@
interactions:
- request:
- body: '"{\"values\": {}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ body: '"{\"values\": {}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"foo.bar\": {\"title\": \"Nested key\",
\"type\": \"string\"}}, \"required\": [\"foo.bar\"], \"additionalProperties\":
+ false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
false}}"'
headers:
Accept:
@@ -10,11 +12,11 @@ interactions:
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '261'
+ - '465'
Content-Type:
- application/json
User-Agent:
@@ -23,21 +25,24 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
- \ \"additionalProperties\": false,\n \"properties\": {\n \"foo.bar\":
- {\n \"title\": \"Nested key\",\n \"type\": \"string\"\n
- \ }\n },\n \"required\": [\n \"foo.bar\"\n ],\n
- \ \"type\": \"object\"\n },\n \"values\": {}\n },\n \"message\":
- \"Data received\"\n}\n"
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {},\n \"values_schema\": {\n \"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {\n \"foo.bar\": {\n \"title\":
+ \"Nested key\",\n \"type\": \"string\"\n }\n },\n \"required\":
+ [\n \"foo.bar\"\n ],\n \"type\": \"object\"\n }\n },\n
+ \ \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '384'
+ - '614'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_multiple_files_component.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_multiple_files_component.yaml
index 54adcac91d..0432360882 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_multiple_files_component.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_multiple_files_component.yaml
@@ -1,22 +1,24 @@
interactions:
- request:
- body: '"{\"values\": {\"file\": []}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ body: '"{\"values\": {\"file\": []}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"file\": {\"title\": \"File\", \"type\":
\"array\", \"items\": {\"type\": \"object\", \"properties\": {\"file_name\":
{\"type\": \"string\"}, \"content\": {\"type\": \"string\", \"format\": \"base64\"}},
\"required\": [], \"additionalProperties\": false}}}, \"required\": [\"file\"],
- \"additionalProperties\": false}}"'
+ \"additionalProperties\": false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\":
+ {}, \"required\": [], \"additionalProperties\": false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '464'
+ - '668'
Content-Type:
- application/json
User-Agent:
@@ -25,7 +27,11 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"file\": []\n },\n \"values_schema\":
+ {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"file\":
{\n \"items\": {\n \"additionalProperties\": false,\n
\ \"properties\": {\n \"content\": {\n \"format\":
@@ -34,17 +40,16 @@ interactions:
\ \"required\": [],\n \"type\": \"object\"\n },\n
\ \"title\": \"File\",\n \"type\": \"array\"\n }\n
\ },\n \"required\": [\n \"file\"\n ],\n \"type\":
- \"object\"\n },\n \"values\": {\n \"file\": []\n }\n },\n \"message\":
- \"Data received\"\n}\n"
+ \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '761'
+ - '991'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_single_file_component.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_single_file_component.yaml
index 1d813a9514..765e103d31 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_single_file_component.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_single_file_component.yaml
@@ -1,19 +1,22 @@
interactions:
- request:
- body: '"{\"values\": {\"file\": null}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ body: '"{\"values\": {\"file\": null}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"file\": {\"title\": \"File\", \"type\":
- \"null\"}}, \"required\": [\"file\"], \"additionalProperties\": false}}"'
+ \"null\"}}, \"required\": [\"file\"], \"additionalProperties\": false}, \"metadata\":
+ {}, \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
+ false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '261'
+ - '465'
Content-Type:
- application/json
User-Agent:
@@ -22,21 +25,24 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"file\": null\n },\n \"values_schema\":
+ {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"file\":
{\n \"title\": \"File\",\n \"type\": \"null\"\n }\n
\ },\n \"required\": [\n \"file\"\n ],\n \"type\":
- \"object\"\n },\n \"values\": {\n \"file\": null\n }\n },\n
- \ \"message\": \"Data received\"\n}\n"
+ \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '394'
+ - '624'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_one_file_upload_for_multiple_files_component.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_one_file_upload_for_multiple_files_component.yaml
index e1a8c0d1c7..947959be17 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_one_file_upload_for_multiple_files_component.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_one_file_upload_for_multiple_files_component.yaml
@@ -1,23 +1,26 @@
interactions:
- request:
body: '"{\"values\": {\"file\": [{\"file_name\": \"file1.txt\", \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\"}]},
- \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"file\": {\"title\": \"File\", \"type\":
\"array\", \"items\": {\"type\": \"object\", \"properties\": {\"file_name\":
{\"type\": \"string\"}, \"content\": {\"type\": \"string\", \"format\": \"base64\"}},
\"required\": [\"file_name\", \"content\"], \"additionalProperties\": false}}},
- \"required\": [\"file\"], \"additionalProperties\": false}}"'
+ \"required\": [\"file\"], \"additionalProperties\": false}, \"metadata\": {},
+ \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
+ false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '571'
+ - '775'
Content-Type:
- application/json
User-Agent:
@@ -26,7 +29,12 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"file\": [\n {\n \"content\":
+ \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n \"file_name\": \"file1.txt\"\n
+ \ }\n ]\n },\n \"values_schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"file\":
{\n \"items\": {\n \"additionalProperties\": false,\n
\ \"properties\": {\n \"content\": {\n \"format\":
@@ -35,19 +43,17 @@ interactions:
\ \"required\": [\n \"file_name\",\n \"content\"\n
\ ],\n \"type\": \"object\"\n },\n \"title\":
\"File\",\n \"type\": \"array\"\n }\n },\n \"required\":
- [\n \"file\"\n ],\n \"type\": \"object\"\n },\n \"values\":
- {\n \"file\": [\n {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n
- \ \"file_name\": \"file1.txt\"\n }\n ]\n }\n },\n
- \ \"message\": \"Data received\"\n}\n"
+ [\n \"file\"\n ],\n \"type\": \"object\"\n }\n },\n \"message\":
+ \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '944'
+ - '1174'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_form_variable_as_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_form_variable_as_data_source.yaml
index 22d85b8a28..74eaa874d7 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_form_variable_as_data_source.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_form_variable_as_data_source.yaml
@@ -1,20 +1,22 @@
interactions:
- request:
- body: '"{\"values\": {\"radio\": \"A\"}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ body: '"{\"values\": {\"radio\": \"A\"}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"radio\": {\"title\": \"Radio\", \"type\":
\"string\", \"enum\": [\"A\", \"B\", \"C\", \"\"]}}, \"required\": [\"radio\"],
- \"additionalProperties\": false}}"'
+ \"additionalProperties\": false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\":
+ {}, \"required\": [], \"additionalProperties\": false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '307'
+ - '511'
Content-Type:
- application/json
User-Agent:
@@ -23,22 +25,25 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"radio\": \"A\"\n },\n \"values_schema\":
+ {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"radio\":
{\n \"enum\": [\n \"A\",\n \"B\",\n \"C\",\n
\ \"\"\n ],\n \"title\": \"Radio\",\n \"type\":
\"string\"\n }\n },\n \"required\": [\n \"radio\"\n
- \ ],\n \"type\": \"object\"\n },\n \"values\": {\n \"radio\":
- \"A\"\n }\n },\n \"message\": \"Data received\"\n}\n"
+ \ ],\n \"type\": \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '498'
+ - '728'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_manual_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_manual_data_source.yaml
index 8b6a98c826..aea759aa8f 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_manual_data_source.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_manual_data_source.yaml
@@ -1,20 +1,22 @@
interactions:
- request:
- body: '"{\"values\": {\"radio\": \"b\"}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ body: '"{\"values\": {\"radio\": \"b\"}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"radio\": {\"title\": \"Radio\", \"type\":
\"string\", \"enum\": [\"a\", \"b\", \"c\", \"\"]}}, \"required\": [\"radio\"],
- \"additionalProperties\": false}}"'
+ \"additionalProperties\": false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\":
+ {}, \"required\": [], \"additionalProperties\": false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '307'
+ - '511'
Content-Type:
- application/json
User-Agent:
@@ -23,22 +25,25 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"radio\": \"b\"\n },\n \"values_schema\":
+ {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"radio\":
{\n \"enum\": [\n \"a\",\n \"b\",\n \"c\",\n
\ \"\"\n ],\n \"title\": \"Radio\",\n \"type\":
\"string\"\n }\n },\n \"required\": [\n \"radio\"\n
- \ ],\n \"type\": \"object\"\n },\n \"values\": {\n \"radio\":
- \"b\"\n }\n },\n \"message\": \"Data received\"\n}\n"
+ \ ],\n \"type\": \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '498'
+ - '728'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_component_with_form_variable_as_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_component_with_form_variable_as_data_source.yaml
index e375fa1af4..1a165657fc 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_component_with_form_variable_as_data_source.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_component_with_form_variable_as_data_source.yaml
@@ -1,23 +1,25 @@
interactions:
- request:
body: '"{\"values\": {\"selectBoxes\": {\"A\": true, \"B\": false, \"C\": true}},
- \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"selectBoxes\": {\"title\": \"Select
Boxes\", \"type\": \"object\", \"additionalProperties\": false, \"properties\":
{\"A\": {\"type\": \"boolean\"}, \"B\": {\"type\": \"boolean\"}, \"C\": {\"type\":
\"boolean\"}}, \"required\": [\"A\", \"B\", \"C\"]}}, \"required\": [\"selectBoxes\"],
- \"additionalProperties\": false}}"'
+ \"additionalProperties\": false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\":
+ {}, \"required\": [], \"additionalProperties\": false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '512'
+ - '716'
Content-Type:
- application/json
User-Agent:
@@ -26,7 +28,12 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"selectBoxes\": {\n \"A\":
+ true,\n \"B\": false,\n \"C\": true\n }\n },\n \"values_schema\":
+ {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"selectBoxes\":
{\n \"additionalProperties\": false,\n \"properties\": {\n
\ \"A\": {\n \"type\": \"boolean\"\n },\n
@@ -35,18 +42,17 @@ interactions:
\ },\n \"required\": [\n \"A\",\n \"B\",\n
\ \"C\"\n ],\n \"title\": \"Select Boxes\",\n
\ \"type\": \"object\"\n }\n },\n \"required\": [\n
- \ \"selectBoxes\"\n ],\n \"type\": \"object\"\n },\n \"values\":
- {\n \"selectBoxes\": {\n \"A\": true,\n \"B\": false,\n
- \ \"C\": true\n }\n }\n },\n \"message\": \"Data received\"\n}\n"
+ \ \"selectBoxes\"\n ],\n \"type\": \"object\"\n }\n },\n
+ \ \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '851'
+ - '1081'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_schema_required_is_empty_when_no_data_is_submitted.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_schema_required_is_empty_when_no_data_is_submitted.yaml
index 15f11609a2..aabe45a726 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_schema_required_is_empty_when_no_data_is_submitted.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_schema_required_is_empty_when_no_data_is_submitted.yaml
@@ -1,21 +1,24 @@
interactions:
- request:
- body: '"{\"values\": {\"selectboxes\": {}}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ body: '"{\"values\": {\"selectboxes\": {}}, \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"selectboxes\": {\"title\": \"Selectboxes\",
\"type\": \"object\", \"properties\": {\"option1\": {\"type\": \"boolean\"},
\"option2\": {\"type\": \"boolean\"}}, \"required\": [], \"additionalProperties\":
- false}}, \"required\": [\"selectboxes\"], \"additionalProperties\": false}}"'
+ false}}, \"required\": [\"selectboxes\"], \"additionalProperties\": false},
+ \"metadata\": {}, \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
+ false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '434'
+ - '638'
Content-Type:
- application/json
User-Agent:
@@ -24,24 +27,28 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"selectboxes\": {}\n },\n
+ \ \"values_schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"selectboxes\":
{\n \"additionalProperties\": false,\n \"properties\": {\n
\ \"option1\": {\n \"type\": \"boolean\"\n },\n
\ \"option2\": {\n \"type\": \"boolean\"\n }\n
\ },\n \"required\": [],\n \"title\": \"Selectboxes\",\n
\ \"type\": \"object\"\n }\n },\n \"required\": [\n
- \ \"selectboxes\"\n ],\n \"type\": \"object\"\n },\n \"values\":
- {\n \"selectboxes\": {}\n }\n },\n \"message\": \"Data received\"\n}\n"
+ \ \"selectboxes\"\n ],\n \"type\": \"object\"\n }\n },\n
+ \ \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '671'
+ - '901'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_form_variable_as_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_form_variable_as_data_source.yaml
index e4800d3959..0cb93ac24f 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_form_variable_as_data_source.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_form_variable_as_data_source.yaml
@@ -1,20 +1,23 @@
interactions:
- request:
- body: '"{\"values\": {\"select\": [\"A\", \"C\"]}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
- \"type\": \"object\", \"properties\": {\"select\": {\"type\": \"array\", \"items\":
- {\"type\": \"string\", \"enum\": [\"A\", \"B\", \"C\", \"\"]}, \"title\": \"Select\"}},
- \"required\": [\"select\"], \"additionalProperties\": false}}"'
+ body: '"{\"values\": {\"select\": [\"A\", \"C\"]}, \"values_schema\": {\"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\":
+ {\"select\": {\"type\": \"array\", \"items\": {\"type\": \"string\", \"enum\":
+ [\"A\", \"B\", \"C\", \"\"]}, \"title\": \"Select\"}}, \"required\": [\"select\"],
+ \"additionalProperties\": false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\":
+ {}, \"required\": [], \"additionalProperties\": false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '354'
+ - '558'
Content-Type:
- application/json
User-Agent:
@@ -23,24 +26,27 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
- \ \"additionalProperties\": false,\n \"properties\": {\n \"select\":
- {\n \"items\": {\n \"enum\": [\n \"A\",\n
- \ \"B\",\n \"C\",\n \"\"\n ],\n
- \ \"type\": \"string\"\n },\n \"title\": \"Select\",\n
- \ \"type\": \"array\"\n }\n },\n \"required\": [\n
- \ \"select\"\n ],\n \"type\": \"object\"\n },\n \"values\":
- {\n \"select\": [\n \"A\",\n \"C\"\n ]\n }\n },\n
- \ \"message\": \"Data received\"\n}\n"
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"select\": [\n \"A\",\n
+ \ \"C\"\n ]\n },\n \"values_schema\": {\n \"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {\n \"select\": {\n \"items\":
+ {\n \"enum\": [\n \"A\",\n \"B\",\n \"C\",\n
+ \ \"\"\n ],\n \"type\": \"string\"\n },\n
+ \ \"title\": \"Select\",\n \"type\": \"array\"\n }\n
+ \ },\n \"required\": [\n \"select\"\n ],\n \"type\":
+ \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '607'
+ - '837'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_manual_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_manual_data_source.yaml
index 81de8fabb6..480106a4fc 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_manual_data_source.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_manual_data_source.yaml
@@ -1,20 +1,23 @@
interactions:
- request:
- body: '"{\"values\": {\"select\": [\"a\", \"c\"]}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
- \"type\": \"object\", \"properties\": {\"select\": {\"type\": \"array\", \"items\":
- {\"type\": \"string\", \"enum\": [\"a\", \"b\", \"c\", \"\"]}, \"title\": \"Select\"}},
- \"required\": [\"select\"], \"additionalProperties\": false}}"'
+ body: '"{\"values\": {\"select\": [\"a\", \"c\"]}, \"values_schema\": {\"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\":
+ {\"select\": {\"type\": \"array\", \"items\": {\"type\": \"string\", \"enum\":
+ [\"a\", \"b\", \"c\", \"\"]}, \"title\": \"Select\"}}, \"required\": [\"select\"],
+ \"additionalProperties\": false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\":
+ {}, \"required\": [], \"additionalProperties\": false}}"'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '354'
+ - '558'
Content-Type:
- application/json
User-Agent:
@@ -23,24 +26,27 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
- \ \"additionalProperties\": false,\n \"properties\": {\n \"select\":
- {\n \"items\": {\n \"enum\": [\n \"a\",\n
- \ \"b\",\n \"c\",\n \"\"\n ],\n
- \ \"type\": \"string\"\n },\n \"title\": \"Select\",\n
- \ \"type\": \"array\"\n }\n },\n \"required\": [\n
- \ \"select\"\n ],\n \"type\": \"object\"\n },\n \"values\":
- {\n \"select\": [\n \"a\",\n \"c\"\n ]\n }\n },\n
- \ \"message\": \"Data received\"\n}\n"
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"select\": [\n \"a\",\n
+ \ \"c\"\n ]\n },\n \"values_schema\": {\n \"$schema\":
+ \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {\n \"select\": {\n \"items\":
+ {\n \"enum\": [\n \"a\",\n \"b\",\n \"c\",\n
+ \ \"\"\n ],\n \"type\": \"string\"\n },\n
+ \ \"title\": \"Select\",\n \"type\": \"array\"\n }\n
+ \ },\n \"required\": [\n \"select\"\n ],\n \"type\":
+ \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '607'
+ - '837'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml
index 60af51a5b9..b4b7bc5620 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml
+++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml
@@ -2,7 +2,7 @@ interactions:
- request:
body: '"{\"values\": {\"auth_bsn\": \"123456789\", \"firstName\": \"We Are\",
\"file\": {\"file_name\": \"test_file.txt\", \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\"}},
- \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"values_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
\"type\": \"object\", \"properties\": {\"auth_bsn\": {\"title\": \"BSN\", \"description\":
\"Uniquely identifies the authenticated person. This value follows the rules
for Dutch social security numbers.\", \"type\": \"string\", \"pattern\": \"^\\\\d{9}$\",
@@ -11,6 +11,8 @@ interactions:
{\"file_name\": {\"type\": \"string\"}, \"content\": {\"type\": \"string\",
\"format\": \"base64\"}}, \"required\": [\"file_name\", \"content\"], \"additionalProperties\":
false}}, \"required\": [\"firstName\", \"file\", \"auth_bsn\"], \"additionalProperties\":
+ false}, \"metadata\": {}, \"metadata_schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\",
+ \"type\": \"object\", \"properties\": {}, \"required\": [], \"additionalProperties\":
false}}"'
headers:
Accept:
@@ -18,11 +20,11 @@ interactions:
Accept-Encoding:
- gzip, deflate, br
Authorization:
- - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI
+ - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3MzgyNTE5NDcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.FBtZBbcuDA_g1oKd797st0yP32GXkZm-mLEkSArZ024
Connection:
- keep-alive
Content-Length:
- - '932'
+ - '1136'
Content-Type:
- application/json
User-Agent:
@@ -31,7 +33,13 @@ interactions:
uri: http://localhost/json_plugin
response:
body:
- string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
+ string: "{\n \"data\": {\n \"metadata\": {},\n \"metadata_schema\": {\n
+ \ \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"additionalProperties\":
+ false,\n \"properties\": {},\n \"required\": [],\n \"type\":
+ \"object\"\n },\n \"values\": {\n \"auth_bsn\": \"123456789\",\n
+ \ \"file\": {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n
+ \ \"file_name\": \"test_file.txt\"\n },\n \"firstName\": \"We
+ Are\"\n },\n \"values_schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n
\ \"additionalProperties\": false,\n \"properties\": {\n \"auth_bsn\":
{\n \"description\": \"Uniquely identifies the authenticated person.
This value follows the rules for Dutch social security numbers.\",\n \"format\":
@@ -45,19 +53,16 @@ interactions:
\"object\"\n },\n \"firstName\": {\n \"title\": \"Firstname\",\n
\ \"type\": \"string\"\n }\n },\n \"required\": [\n
\ \"firstName\",\n \"file\",\n \"auth_bsn\"\n ],\n
- \ \"type\": \"object\"\n },\n \"values\": {\n \"auth_bsn\":
- \"123456789\",\n \"file\": {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n
- \ \"file_name\": \"test_file.txt\"\n },\n \"firstName\": \"We
- Are\"\n }\n },\n \"message\": \"Data received\"\n}\n"
+ \ \"type\": \"object\"\n }\n },\n \"message\": \"Data received\"\n}\n"
headers:
Connection:
- close
Content-Length:
- - '1315'
+ - '1545'
Content-Type:
- application/json
Date:
- - Mon, 27 Jan 2025 11:59:48 GMT
+ - Thu, 30 Jan 2025 15:45:47 GMT
Server:
- Werkzeug/3.1.3 Python/3.12.8
status:
diff --git a/src/openforms/registrations/contrib/json_dump/tests/test_backend.py b/src/openforms/registrations/contrib/json_dump/tests/test_backend.py
index 48d237e84c..0ae3e25e10 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/test_backend.py
+++ b/src/openforms/registrations/contrib/json_dump/tests/test_backend.py
@@ -5,10 +5,12 @@
from django.core.exceptions import SuspiciousOperation
from django.test import TestCase
+from freezegun import freeze_time
from requests import RequestException
from zgw_consumers.test.factories import ServiceFactory
from openforms.formio.constants import DataSrcOptions
+from openforms.forms.tests.factories import FormVersionFactory
from openforms.submissions.tests.factories import (
FormVariableFactory,
SubmissionFactory,
@@ -70,58 +72,61 @@ def test_submission_happy_flow(self):
"service": self.service,
"path": "json_plugin",
"variables": ["firstName", "file", "auth_bsn"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
json_plugin = JSONDumpRegistration("json_registration_plugin")
- expected_response = {
+ expected_values = {
# Note that `lastName` is not included here as it wasn't specified in the variables
- "data": {
- "values": {
- "auth_bsn": "123456789",
- "firstName": "We Are",
- "file": {
- "file_name": "test_file.txt",
- "content": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu",
- },
+ "auth_bsn": "123456789",
+ "firstName": "We Are",
+ "file": {
+ "file_name": "test_file.txt",
+ "content": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu",
+ },
+ }
+ expected_schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "auth_bsn": {
+ "title": "BSN",
+ "description": (
+ "Uniquely identifies the authenticated person. This "
+ "value follows the rules for Dutch social security "
+ "numbers."
+ ),
+ "type": "string",
+ "pattern": "^\\d{9}$",
+ "format": "nl-bsn",
},
- "schema": {
- "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "firstName": {"title": "Firstname", "type": "string"},
+ "file": {
+ "title": "File",
"type": "object",
"properties": {
- "auth_bsn": {
- "title": "BSN",
- "description": (
- "Uniquely identifies the authenticated person. This "
- "value follows the rules for Dutch social security "
- "numbers."
- ),
- "type": "string",
- "pattern": "^\\d{9}$",
- "format": "nl-bsn",
- },
- "firstName": {"title": "Firstname", "type": "string"},
- "file": {
- "title": "File",
- "type": "object",
- "properties": {
- "file_name": {"type": "string"},
- "content": {"type": "string", "format": "base64"},
- },
- "required": ["file_name", "content"],
- "additionalProperties": False,
- },
+ "file_name": {"type": "string"},
+ "content": {"type": "string", "format": "base64"},
},
- "required": ["firstName", "file", "auth_bsn"],
+ "required": ["file_name", "content"],
"additionalProperties": False,
},
},
- "message": "Data received",
+ "required": ["firstName", "file", "auth_bsn"],
+ "additionalProperties": False,
}
result = json_plugin.register_submission(submission, options)
assert result is not None
- self.assertEqual(result["api_response"], expected_response)
+ with self.subTest("values"):
+ self.assertEqual(result["api_response"]["data"]["values"], expected_values)
+
+ with self.subTest("schema"):
+ self.assertEqual(
+ result["api_response"]["data"]["values_schema"], expected_schema
+ )
with self.subTest("attachment content encoded"):
decoded_content = b64decode(
@@ -145,6 +150,8 @@ def test_exception_raised_when_service_returns_unexpected_status_code(self):
"service": self.service,
"path": "fake_endpoint",
"variables": ["firstName", "auth_bsn"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
json_plugin = JSONDumpRegistration("json_registration_plugin")
@@ -200,49 +207,55 @@ def test_multiple_file_uploads(self):
"service": self.service,
"path": "json_plugin",
"variables": ["file"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
json_plugin = JSONDumpRegistration("json_registration_plugin")
- expected_data = {
- "values": {
- "file": [
- {
- "file_name": "file1.txt",
- "content": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu", # This is example content.
- },
- {
- "file_name": "file2.txt",
- "content": "Q29udGVudCBleGFtcGxlIGlzIHRoaXMu", # Content example is this.
- },
- ],
- },
- "schema": {
- "$schema": "https://json-schema.org/draft/2020-12/schema",
- "type": "object",
- "properties": {
- "file": {
- "title": "File",
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "file_name": {"type": "string"},
- "content": {"type": "string", "format": "base64"},
- },
- "required": ["file_name", "content"],
- "additionalProperties": False,
- },
- }
+ expected_values = {
+ "file": [
+ {
+ "file_name": "file1.txt",
+ "content": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu", # This is example content.
+ },
+ {
+ "file_name": "file2.txt",
+ "content": "Q29udGVudCBleGFtcGxlIGlzIHRoaXMu", # Content example is this.
},
- "additionalProperties": False,
- "required": ["file"],
+ ],
+ }
+ expected_schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "file": {
+ "title": "File",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "file_name": {"type": "string"},
+ "content": {"type": "string", "format": "base64"},
+ },
+ "required": ["file_name", "content"],
+ "additionalProperties": False,
+ },
+ }
},
+ "additionalProperties": False,
+ "required": ["file"],
}
result = json_plugin.register_submission(submission, options)
assert result is not None
- self.assertEqual(result["api_response"]["data"], expected_data)
+ with self.subTest("values"):
+ self.assertEqual(result["api_response"]["data"]["values"], expected_values)
+
+ with self.subTest("schema"):
+ self.assertEqual(
+ result["api_response"]["data"]["values_schema"], expected_schema
+ )
def test_one_file_upload_for_multiple_files_component(self):
submission = SubmissionFactory.from_components(
@@ -276,45 +289,51 @@ def test_one_file_upload_for_multiple_files_component(self):
"service": self.service,
"path": "json_plugin",
"variables": ["file"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
json_plugin = JSONDumpRegistration("json_registration_plugin")
result = json_plugin.register_submission(submission, options)
assert result is not None
- expected_data = {
- "values": {
- "file": [
- {
- "file_name": "file1.txt",
- "content": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu", # This is example content.
- },
- ],
- },
- "schema": {
- "$schema": "https://json-schema.org/draft/2020-12/schema",
- "type": "object",
- "properties": {
- "file": {
- "title": "File",
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "file_name": {"type": "string"},
- "content": {"type": "string", "format": "base64"},
- },
- "required": ["file_name", "content"],
- "additionalProperties": False,
- },
- }
+ expected_values = {
+ "file": [
+ {
+ "file_name": "file1.txt",
+ "content": "VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu", # This is example content.
},
- "additionalProperties": False,
- "required": ["file"],
+ ],
+ }
+ expected_schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "file": {
+ "title": "File",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "file_name": {"type": "string"},
+ "content": {"type": "string", "format": "base64"},
+ },
+ "required": ["file_name", "content"],
+ "additionalProperties": False,
+ },
+ }
},
+ "additionalProperties": False,
+ "required": ["file"],
}
- self.assertEqual(result["api_response"]["data"], expected_data)
+ with self.subTest("values"):
+ self.assertEqual(result["api_response"]["data"]["values"], expected_values)
+
+ with self.subTest("schema"):
+ self.assertEqual(
+ result["api_response"]["data"]["values_schema"], expected_schema
+ )
def test_no_file_upload_for_single_file_component(self):
submission = SubmissionFactory.from_components(
@@ -330,29 +349,35 @@ def test_no_file_upload_for_single_file_component(self):
"service": self.service,
"path": "json_plugin",
"variables": ["file"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
json_plugin = JSONDumpRegistration("json_registration_plugin")
result = json_plugin.register_submission(submission, options)
assert result is not None
- expected_data = {
- "values": {"file": None},
- "schema": {
- "$schema": "https://json-schema.org/draft/2020-12/schema",
- "type": "object",
- "properties": {
- "file": {
- "title": "File",
- "type": "null",
- },
+ expected_values = {"file": None}
+ expected_schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "file": {
+ "title": "File",
+ "type": "null",
},
- "additionalProperties": False,
- "required": ["file"],
},
+ "additionalProperties": False,
+ "required": ["file"],
}
- self.assertEqual(result["api_response"]["data"], expected_data)
+ with self.subTest("values"):
+ self.assertEqual(result["api_response"]["data"]["values"], expected_values)
+
+ with self.subTest("schema"):
+ self.assertEqual(
+ result["api_response"]["data"]["values_schema"], expected_schema
+ )
def test_no_file_upload_for_multiple_files_component(self):
submission = SubmissionFactory.from_components(
@@ -368,38 +393,44 @@ def test_no_file_upload_for_multiple_files_component(self):
"service": self.service,
"path": "json_plugin",
"variables": ["file"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
json_plugin = JSONDumpRegistration("json_registration_plugin")
result = json_plugin.register_submission(submission, options)
assert result is not None
- expected_data = {
- "values": {"file": []},
- "schema": {
- "$schema": "https://json-schema.org/draft/2020-12/schema",
- "type": "object",
- "properties": {
- "file": {
- "title": "File",
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "file_name": {"type": "string"},
- "content": {"type": "string", "format": "base64"},
- },
- "required": [],
- "additionalProperties": False,
+ expected_values = {"file": []}
+ expected_schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "file": {
+ "title": "File",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "file_name": {"type": "string"},
+ "content": {"type": "string", "format": "base64"},
},
- }
- },
- "required": ["file"],
- "additionalProperties": False,
+ "required": [],
+ "additionalProperties": False,
+ },
+ }
},
+ "required": ["file"],
+ "additionalProperties": False,
}
- self.assertEqual(result["api_response"]["data"], expected_data)
+ with self.subTest("values"):
+ self.assertEqual(result["api_response"]["data"]["values"], expected_values)
+
+ with self.subTest("schema"):
+ self.assertEqual(
+ result["api_response"]["data"]["values_schema"], expected_schema
+ )
def test_path_traversal_attack(self):
submission = SubmissionFactory.from_components(
@@ -420,6 +451,8 @@ def test_path_traversal_attack(self):
"service": self.service,
"path": "..",
"variables": ["firstName", "file", "auth_bsn"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
json_plugin = JSONDumpRegistration("json_registration_plugin")
@@ -451,14 +484,16 @@ def test_select_boxes_schema_required_is_empty_when_no_data_is_submitted(self):
"service": self.service,
"path": "json_plugin",
"variables": ["selectboxes"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
result = json_plugin.register_submission(submission, options)
assert result is not None
self.assertEqual(
- result["api_response"]["data"]["schema"]["properties"]["selectboxes"][
- "required"
- ],
+ result["api_response"]["data"]["values_schema"]["properties"][
+ "selectboxes"
+ ]["required"],
[],
)
@@ -494,15 +529,17 @@ def test_select_component_with_manual_data_source(self):
"service": self.service,
"path": "json_plugin",
"variables": ["select"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
result = json_plugin.register_submission(submission, options)
assert result is not None
self.assertEqual(
- result["api_response"]["data"]["schema"]["properties"]["select"]["items"][
- "enum"
- ],
+ result["api_response"]["data"]["values_schema"]["properties"]["select"][
+ "items"
+ ]["enum"],
["a", "b", "c", ""],
)
@@ -548,15 +585,17 @@ def test_select_component_with_form_variable_as_data_source(self):
"service": self.service,
"path": "json_plugin",
"variables": ["select"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
result = json_plugin.register_submission(submission, options)
assert result is not None
self.assertEqual(
- result["api_response"]["data"]["schema"]["properties"]["select"]["items"][
- "enum"
- ],
+ result["api_response"]["data"]["values_schema"]["properties"]["select"][
+ "items"
+ ]["enum"],
["A", "B", "C", ""],
)
@@ -596,6 +635,8 @@ def test_select_boxes_component_with_form_variable_as_data_source(self):
"service": self.service,
"path": "json_plugin",
"variables": ["selectBoxes"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
result = json_plugin.register_submission(submission, options)
@@ -614,7 +655,9 @@ def test_select_boxes_component_with_form_variable_as_data_source(self):
}
self.assertEqual(
- result["api_response"]["data"]["schema"]["properties"]["selectBoxes"],
+ result["api_response"]["data"]["values_schema"]["properties"][
+ "selectBoxes"
+ ],
expected_schema,
)
@@ -642,13 +685,17 @@ def test_radio_component_with_manual_data_source(self):
"service": self.service,
"path": "json_plugin",
"variables": ["radio"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
result = json_plugin.register_submission(submission, options)
assert result is not None
self.assertEqual(
- result["api_response"]["data"]["schema"]["properties"]["radio"]["enum"],
+ result["api_response"]["data"]["values_schema"]["properties"]["radio"][
+ "enum"
+ ],
["a", "b", "c", ""],
)
@@ -687,13 +734,17 @@ def test_radio_component_with_form_variable_as_data_source(self):
"service": self.service,
"path": "json_plugin",
"variables": ["radio"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
result = json_plugin.register_submission(submission, options)
assert result is not None
self.assertEqual(
- result["api_response"]["data"]["schema"]["properties"]["radio"]["enum"],
+ result["api_response"]["data"]["values_schema"]["properties"]["radio"][
+ "enum"
+ ],
["A", "B", "C", ""],
)
@@ -715,6 +766,8 @@ def test_nested_component_key(self):
"service": self.service,
"path": "json_plugin",
"variables": ["foo.bar"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
result = json_plugin.register_submission(submission, options)
@@ -722,6 +775,82 @@ def test_nested_component_key(self):
self.assertEqual(result["api_response"]["data"]["values"]["foo.bar"], "baz")
self.assertEqual(
- result["api_response"]["data"]["schema"]["properties"]["foo.bar"]["type"],
+ result["api_response"]["data"]["values_schema"]["properties"]["foo.bar"][
+ "type"
+ ],
"string",
)
+
+ @freeze_time("2025-01-30T13:05:00Z")
+ def test_metadata(self):
+ submission = SubmissionFactory.from_components(
+ [
+ {"key": "firstName", "type": "textfield"},
+ {"key": "lastName", "type": "textfield"},
+ ],
+ completed=True,
+ submitted_data={
+ "firstName": "We Are",
+ "lastName": "Checking",
+ },
+ bsn="123456789",
+ public_registration_reference="OF-ABC123",
+ )
+ FormVersionFactory.create(form=submission.form, description="Version 1.0")
+
+ json_plugin = JSONDumpRegistration("json_registration_plugin")
+ options: JSONDumpOptions = {
+ "service": self.service,
+ "path": "json_plugin",
+ "variables": [],
+ "fixed_metadata_variables": [
+ "form_version",
+ "public_reference",
+ "registration_timestamp",
+ ],
+ "additional_metadata_variables": ["auth_type"],
+ }
+ result = json_plugin.register_submission(submission, options)
+ assert result is not None
+
+ expected_metadata = {
+ "auth_type": "bsn",
+ "form_version": "Version 1.0",
+ "public_reference": "OF-ABC123",
+ "registration_timestamp": "2025-01-30T13:05:00Z",
+ }
+ expected_schema = {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "additionalProperties": False,
+ "properties": {
+ "auth_type": {
+ "enum": ["bsn", "kvk", "pseudo", "employee_id", ""],
+ "title": "Authentication " "type",
+ "type": "string",
+ },
+ "form_version": {"title": "Form version", "type": "string"},
+ "public_reference": {"title": "Public " "reference", "type": "string"},
+ "registration_timestamp": {
+ "format": "date-time",
+ "title": "Registration " "timestamp",
+ "type": "string",
+ },
+ },
+ "required": [
+ "form_version",
+ "public_reference",
+ "registration_timestamp",
+ "auth_type",
+ ],
+ "type": "object",
+ }
+
+ with self.subTest("metadata"):
+ self.assertEqual(
+ result["api_response"]["data"]["metadata"], expected_metadata
+ )
+
+ with self.subTest("schema"):
+ self.assertEqual(
+ result["api_response"]["data"]["metadata_schema"], expected_schema
+ )
diff --git a/src/openforms/registrations/contrib/json_dump/tests/test_config.py b/src/openforms/registrations/contrib/json_dump/tests/test_config.py
index d499e4125d..70b6a7925e 100644
--- a/src/openforms/registrations/contrib/json_dump/tests/test_config.py
+++ b/src/openforms/registrations/contrib/json_dump/tests/test_config.py
@@ -13,6 +13,8 @@ def test_serializer_raises_validation_error_on_path_traversal(self):
"service": service.pk,
"path": "",
"variables": ["now"],
+ "fixed_metadata_variables": [],
+ "additional_metadata_variables": [],
}
# Ensuring that the options are valid in the first place
diff --git a/src/openforms/registrations/contrib/json_dump/tests/test_registration_variables.py b/src/openforms/registrations/contrib/json_dump/tests/test_registration_variables.py
new file mode 100644
index 0000000000..a760b87b42
--- /dev/null
+++ b/src/openforms/registrations/contrib/json_dump/tests/test_registration_variables.py
@@ -0,0 +1,27 @@
+from django.test import TestCase
+
+from openforms.forms.tests.factories import FormVersionFactory
+from openforms.submissions.tests.factories import SubmissionFactory
+
+from ..registration_variables import register
+
+
+def _get_variable(key: str, **kwargs):
+ return register[key].get_static_variable(**kwargs)
+
+
+class FormVersionTests(TestCase):
+ def test_without_submission(self):
+ variable = _get_variable("form_version")
+
+ self.assertEqual(variable.initial_value, "")
+
+ def test_with_submission(self):
+ submission = SubmissionFactory.create()
+
+ FormVersionFactory.create(form=submission.form, description="Version 1")
+ FormVersionFactory.create(form=submission.form, description="Version 2")
+
+ variable = _get_variable("form_version", submission=submission)
+
+ self.assertEqual(variable.initial_value, "Version 2")