Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse mapping of form variables to verzoektype and enhanced data handling #4922

Open
Tracked by #4945
joeridiederen opened this issue Dec 16, 2024 · 2 comments
Open
Tracked by #4945
Labels
enhancement owner: dimpact waiting for approval An estimate was made but the stakeholder still needs to approve it.

Comments

@joeridiederen
Copy link

joeridiederen commented Dec 16, 2024

Thema / Theme

Frontend

Omschrijving / Description

This RFC proposes a restructured approach to how form variables (keys) in Open Forms are mapped to the corresponding keys in an object type (verzoektype). Instead of the current non-intuitive, form-variable-driven mapping that often requires complex JSON logic, we introduce a verzoektype-driven approach. This interface change will display verzoektype fields (e.g., on the left side) and allow users to fill them with the appropriate form variables.

The desired outcome is to empower users to construct fields by composing multiple form variables using the existing template functionalities in Open Forms, such as variable placeholders {{ variable }}, conditional logic ({% if %}, elif, and, or, etc.), and formatting options.

This approach also streamlines schemas and reduces the reliance on JSON logic for value convergence and replacement.

Additionally, this RFC describes enhancements to handle array and object data types more elegantly, as well as an option to conditionally omit empty values to avoid unnecessary validation issues.

Added value / Toegevoegde waarde

  • By reversing the mapping order (from request-type fields to form variables), users gain a clearer overview of which fields need which data, reducing confusion and complexity.
  • The ability to combine multiple form variables into a single verzoektype-field allows for improved flexibility. For instance, assembling a "full name" field from multiple authentication methods or constructing a "description" field from various form variables for posting to backend systems.
    • With variables composed directly in the request-type schema fields, the reliance on JSON logic for transformations diminishes, simplifying form configurations and maintenance.
  • Improved handling of array and object data types ensures better compatibility with external systems that expect these formats (e.g., Dimpact’s PodiumD, ZAC). This includes correct parsing, validation, and mapping, resulting in fewer integration challenges. For example: an optional object with required values is not correctly processed at the moment (2.7.9 alert).
  • Introducing a checkbox “Do not post if empty” for each mapped field helps avoid unnecessary schema keys from being posted. This prevents validation issues in scenarios where “oneOf” constraints exist (e.g., either KvK or BSN must be present, but not both).

Aanvullende opmerkingen / Additional context

Currently, JSON logic is heavily used (at least in Rotterdam) to adapt form variables to match request-type field formats. By shifting to a verzoektype-driven interface and leveraging template syntax directly in the fields, the complexity of transformations will be significantly reduced.

@joeridiederen joeridiederen added enhancement triage Issue needs to be validated. Remove this label if the issue considered valid. labels Dec 16, 2024
@sergei-maertens sergei-maertens removed the triage Issue needs to be validated. Remove this label if the issue considered valid. label Dec 16, 2024
@sergei-maertens
Copy link
Member

Refinement: the big picture is clear, the implementation details will be fleshed out when we pick this up.

@sergei-maertens
Copy link
Member

Estimate: 5 weeks (including 2 weeks timebox for editor prototyping/research)

@sergei-maertens sergei-maertens added owner: dimpact waiting for approval An estimate was made but the stakeholder still needs to approve it. labels Dec 16, 2024
@joeribekker joeribekker added epic Large theme and/or meta issue and removed epic Large theme and/or meta issue labels Dec 17, 2024
@joeribekker joeribekker removed the epic Large theme and/or meta issue label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement owner: dimpact waiting for approval An estimate was made but the stakeholder still needs to approve it.
Projects
None yet
Development

No branches or pull requests

3 participants