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

Provide ValidationError code in OperationMessage #356

Closed
1 task done
zvyn opened this issue Sep 7, 2023 · 1 comment
Closed
1 task done

Provide ValidationError code in OperationMessage #356

zvyn opened this issue Sep 7, 2023 · 1 comment

Comments

@zvyn
Copy link
Contributor

zvyn commented Sep 7, 2023

I propose to extend the OperationMessage by a code attribute that is set to the ValidationError.code if a ValidationError was raised.

Feature Request Type

  • Alteration (enhancement/optimization) of existing feature(s)

Description

The Django ValidationError has a code attribute which can be set on initialization. This feature is already used by Django internally and part of the official API for most validators.

Our use-case: For a project with optional client-side localization we want to provide predictable error codes that can be translated by the client without parsing the human-friendly message string. I'm sure there are other use-cases as well.

I can work on a pull request for this in case you are interested!

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@bellini666
Copy link
Member

I like this :)

Feel free to work on this and open a PR, I'll gladly review it when it is submitted.

zvyn added a commit to zvyn/strawberry-graphql-django that referenced this issue Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants