Skip to content

Validate prefill.json #1375

Description

@HauklandJ

A support case reporting issues with instantiating an application in TT02 and not locally was reported.

Investigation into the application showed that the error, which was a generic 500 error;

Message: Request failed with status code 500
Request: POST 'https://hb.apps.tt02.altinn.no/hb/prosjekt-25-laan-privat/instances?instanceOwnerPartyId=51564076&language=nb'
Response: Instantiation of data elements failed for instance 51564076/add8b18b-55e6-4360-a7e1-3a2c87bee02c for party 51564076

was caused by a mismatch in the datamodel type and the type of the prefill data.
The app had an int? field, prefill was ´string´.

This worked in the case of "123", as the mapping is lenient, but not in the case of empty string ""

Possible solutions:

Startup validation of prefill.json:
If mismatch between types, give a build warning.

Special case for empty string:
"" leads to
0 for int and
null for int?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions