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

Objecttype v2 mapping: Upload in repeating group "replaces" all other data in repeating group on submit #4689

Closed
Tracked by #4942
LaurensBurger opened this issue Sep 20, 2024 · 2 comments · Fixed by #5059
Assignees
Labels
needs-backport Fix must be backported to stable release branch owner: den-haag topic: repeating group waiting for approval An estimate was made but the stakeholder still needs to approve it.
Milestone

Comments

@LaurensBurger
Copy link
Collaborator

LaurensBurger commented Sep 20, 2024

Product versie / Product version

2.6.x

Customer reference

DH

Omschrijf het probleem / Describe the bug

When "Bijlage informatieobjecttype" is set and a upload is present in a repeating group it replaces all values in the repeating group with just the result of the attachment upload:

json output with upload:

{
    "type": "https://objecttypen.nl/api/v2/objecttypes/6e3a6f27-d248-46eb-853d-1373a1b9c6b0",
    "record": {
        "typeVersion": 2,
        "data": {
            "step": [
            "https://openzaak.nl/documenten/api/v1/enkelvoudiginformatieobjecten/f9699f02-24fd-4799-8fcf-8c2aac434de0"
            ]
        },
        "startAt": "2024-09-20"
    }
}

output no upload:

{
    "type": "https://objecttypen.nl/api/v2/objecttypes/6e3a6f27-d248-46eb-853d-1373a1b9c6b0",
    "record": {
        "typeVersion": 2,
        "data": {
            "step": [
                {
                    "tekstveld": "1",
                    "1tekstveld": "a",
                    "eMailadres": "foo@bar.com",
                    "bestandsupload": []
                }
            ]
        },
        "startAt": "2024-09-20"
    }
}
@LaurensBurger LaurensBurger added bug triage Issue needs to be validated. Remove this label if the issue considered valid. labels Sep 20, 2024
@open-formulieren open-formulieren deleted a comment Sep 20, 2024
@LaurensBurger LaurensBurger changed the title Objecttype v2 mapping: Upload in repeating group "replaces all other data in repeating group on submit Objecttype v2 mapping: Upload in repeating group "replaces" all other data in repeating group on submit Sep 20, 2024
@joeribekker joeribekker removed the triage Issue needs to be validated. Remove this label if the issue considered valid. label Sep 23, 2024
@joeribekker joeribekker added this to the Release 3.0 milestone Sep 23, 2024
@joeribekker joeribekker added the needs-backport Fix must be backported to stable release branch label Sep 23, 2024
@joeribekker joeribekker added owner: den-haag waiting for approval An estimate was made but the stakeholder still needs to approve it. labels Sep 23, 2024
@joeribekker
Copy link
Contributor

Estimate: 2-3 days

@joeribekker
Copy link
Contributor

Akkoord is gisteren gegeven door Teun Winkelmolen, in Utrecht.

@joeribekker joeribekker added this to the Release 3.0.2 milestone Jan 16, 2025
@sergei-maertens sergei-maertens moved this from Todo to In Progress in Development Jan 27, 2025
sergei-maertens added a commit that referenced this issue Jan 29, 2025
Moved the file component key/value processing to the mapped variable
processing instead of special casing this in the registration handler,
since we will need access to the component types to handle editgrids
which have file uploads inside, as these have different data paths
*and* will require recursion as well since there can be editgrids
inside editgrids that have this problem.

The alternative is special casing repeating groups too, which breaks
the mechanism to do component-specific post-processing in the
dedicated function.

This also updates the query for the submission variables so that if we
have a more exact data path for an upload (inside a repeating group)
that we use that instead of messing with the container editgrid which
incorrectly gets replaced now. For uploads *not* in repeating groups,
this data path is empty because it's identical to the variable key,
so we can coalesce there at the DB level to calculate this in a
unified way.

See also #2713 that highlights the difficulties with how file uploads
are now processed, which requires some proper re-structuring.
sergei-maertens added a commit that referenced this issue Jan 29, 2025
Fixed/added some type definitions to make it easier to reason about
the data being operated on.
sergei-maertens added a commit that referenced this issue Jan 29, 2025
We must look up the uploads in the url map and replace only the
file component nodes in the item values rather than the whole
repeating group. This also needs to recurse, since in theory
the repeating group can have another repeating group inside
it.
@sergei-maertens sergei-maertens moved this from In Progress to Implemented in Development Jan 29, 2025
sergei-maertens added a commit that referenced this issue Jan 30, 2025
Moved the file component key/value processing to the mapped variable
processing instead of special casing this in the registration handler,
since we will need access to the component types to handle editgrids
which have file uploads inside, as these have different data paths
*and* will require recursion as well since there can be editgrids
inside editgrids that have this problem.

The alternative is special casing repeating groups too, which breaks
the mechanism to do component-specific post-processing in the
dedicated function.

This also updates the query for the submission variables so that if we
have a more exact data path for an upload (inside a repeating group)
that we use that instead of messing with the container editgrid which
incorrectly gets replaced now. For uploads *not* in repeating groups,
this data path is empty because it's identical to the variable key,
so we can coalesce there at the DB level to calculate this in a
unified way.

See also #2713 that highlights the difficulties with how file uploads
are now processed, which requires some proper re-structuring.
sergei-maertens added a commit that referenced this issue Jan 30, 2025
Fixed/added some type definitions to make it easier to reason about
the data being operated on.
sergei-maertens added a commit that referenced this issue Jan 30, 2025
We must look up the uploads in the url map and replace only the
file component nodes in the item values rather than the whole
repeating group. This also needs to recurse, since in theory
the repeating group can have another repeating group inside
it.
sergei-maertens added a commit that referenced this issue Jan 31, 2025
Moved the file component key/value processing to the mapped variable
processing instead of special casing this in the registration handler,
since we will need access to the component types to handle editgrids
which have file uploads inside, as these have different data paths
*and* will require recursion as well since there can be editgrids
inside editgrids that have this problem.

The alternative is special casing repeating groups too, which breaks
the mechanism to do component-specific post-processing in the
dedicated function.

This also updates the query for the submission variables so that if we
have a more exact data path for an upload (inside a repeating group)
that we use that instead of messing with the container editgrid which
incorrectly gets replaced now. For uploads *not* in repeating groups,
this data path is empty because it's identical to the variable key,
so we can coalesce there at the DB level to calculate this in a
unified way.

See also #2713 that highlights the difficulties with how file uploads
are now processed, which requires some proper re-structuring.
sergei-maertens added a commit that referenced this issue Jan 31, 2025
Fixed/added some type definitions to make it easier to reason about
the data being operated on.
sergei-maertens added a commit that referenced this issue Jan 31, 2025
We must look up the uploads in the url map and replace only the
file component nodes in the item values rather than the whole
repeating group. This also needs to recurse, since in theory
the repeating group can have another repeating group inside
it.
@github-project-automation github-project-automation bot moved this from Implemented to Done in Development Jan 31, 2025
sergei-maertens added a commit that referenced this issue Jan 31, 2025
Moved the file component key/value processing to the mapped variable
processing instead of special casing this in the registration handler,
since we will need access to the component types to handle editgrids
which have file uploads inside, as these have different data paths
*and* will require recursion as well since there can be editgrids
inside editgrids that have this problem.

The alternative is special casing repeating groups too, which breaks
the mechanism to do component-specific post-processing in the
dedicated function.

This also updates the query for the submission variables so that if we
have a more exact data path for an upload (inside a repeating group)
that we use that instead of messing with the container editgrid which
incorrectly gets replaced now. For uploads *not* in repeating groups,
this data path is empty because it's identical to the variable key,
so we can coalesce there at the DB level to calculate this in a
unified way.

See also #2713 that highlights the difficulties with how file uploads
are now processed, which requires some proper re-structuring.

We must look up the uploads in the url map and replace only the
file component nodes in the item values rather than the whole
repeating group. This also needs to recurse, since in theory
the repeating group can have another repeating group inside
it.

Backport-of: #5059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-backport Fix must be backported to stable release branch owner: den-haag topic: repeating group waiting for approval An estimate was made but the stakeholder still needs to approve it.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants