Altinn / altinn-pdf

Altinn platform microservice for generating PDFs
0 stars 1 forks source link

Pdf service crashes if layout component is missing textResourceBindings #54

Closed tjololo closed 1 year ago

tjololo commented 1 year ago

Description of the bug

If a layout component eg. Input or any other component is missing textResourceBindings PDF-service fails to generate PDF and returns 500

Steps To Reproduce

Create a app with a layout like this:

{
  "$schema": "https://altinncdn.no/schemas/json/layout/layout.schema.v1.json",
  "data": {
    "layout": [
      {
        "id": "30558946-9d1d-4a49-898c-79d94b858e01",
        "type": "Input",
        "dataModelBindings": {
          "simpleBinding": "melding.name"
        },
        "required": true,
        "readOnly": false
      }
    ]
  }
}

Deploy app and see PDF service return http 500 response due to textResourceBindings being null.

Additional Information

No response

FinnurO commented 1 year ago

Should be caught in app validation in Studio or deploy checks? Completness and consistency checks?

tjololo commented 1 year ago

Slack discussion: https://altinn.slack.com/archives/C02FK32SFA4/p1669189333588629

tjololo commented 1 year ago

Workaround, add empty textresourcebindings:

{
  "$schema": "https://altinncdn.no/schemas/json/layout/layout.schema.v1.json",
  "data": {
    "layout": [
      {
        "id": "30558946-9d1d-4a49-898c-79d94b858e01",
        "type": "Input",
        "dataModelBindings": {
          "simpleBinding": "melding.name"
        },
+       "textResourceBindings": {},
        "required": true,
        "readOnly": false
      }
    ]
  }
}
SandGrainOne commented 1 year ago

Workaround good enough for now. New PDF generator will not have this issue.