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

Validation that fails during IInstantiationValidator returns only the "text key" from resource-file back to the user in JSON-response. #812

Open
violaguttorm opened this issue Sep 24, 2024 · 2 comments
Labels
good-first-issue Issues that are easy to fix for new team members or external contributors kind/feature-request New feature or request

Comments

@violaguttorm
Copy link

Description of the bug

We allow users to send in data via "maskinell innrapportering", such as doing it by Postman through pure JSON or creating their own front-end. This works fine for the most part, but while validation of most elements returns both the text key and the actual text the user should get back from the resource.[language].json file, when validation fails during the IInstantiationValidator process specifically the user is only given back the key. This can be cryptic, as the user has no idea what (for instance) rrh.notinregister means.

The source code is in this app: https://altinn.studio/repos/brg/rrh-innrapportering
URL in TT02: https://brg.apps.tt02.altinn.no/brg/rrh-innrapportering/

Steps To Reproduce

  1. Connect to this app through Postman by using any virksomhet ENK.
  2. Try creating a new Instance.
  3. Observe the error message only returning the code.
    (You might also see it not being there in the JSON response given back through a regular failed instantiation by using the app itself, but I'm not sure.)

Additional Information

No response

@violaguttorm violaguttorm added the kind/bug Something isn't working label Sep 24, 2024
@olemartinorg olemartinorg transferred this issue from Altinn/app-frontend-react Oct 3, 2024
@olemartinorg olemartinorg added kind/feature-request New feature or request and removed kind/bug Something isn't working labels Oct 3, 2024
@olemartinorg
Copy link
Contributor

I believe this is the way it's always been. Systems delivering via API are expected to provide their own translations of these error codes to users. I changed this issue to be a feature request, and moved it to the app-lib-dotnet repo. Using translations from the resources files may be non-trivial if backend is to look up variables in texts as well.

@ivarne
Copy link
Member

ivarne commented Oct 3, 2024

I think it would be relatively straightforward to add logic to the ValidationService so that a ValidationIssue with CustomTextKey set, can check the translations and fill the Description field with the correct value. Tagging as up for grabs, but it should wait for multiple data models, as validation service gets a major rewrite.

@ivarne ivarne added good-first-issue Issues that are easy to fix for new team members or external contributors and removed status/triage labels Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Issues that are easy to fix for new team members or external contributors kind/feature-request New feature or request
Projects
Status: No status
Development

No branches or pull requests

3 participants