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

feat: Add ValidationError code to OperationMessage #358

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

zvyn
Copy link
Contributor

@zvyn zvyn commented Sep 8, 2023

Description

Extends the OperationMessage by a code attribute that is set to the ValidationError.code if available.

I changed the test project to apply Djangos default validation in order to test that error codes used by Django internally are passed through as expected. This had the side-effect of turning a datetime object into a date object in an otherwise unrelated test.

Types of Changes

  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@bellini666 bellini666 enabled auto-merge (squash) September 8, 2023 14:05
@bellini666
Copy link
Member

This had the side-effect of turning a datetime object into a date object in an otherwise unrelated test.

Oh, I know what happened. The field is a DateField, but the argument was typed as datetime. It is actually a bug in the test that your change identified because you called .full_clean() on the model.

It is harmless though and I'll fix it later :)

Copy link
Member

@bellini666 bellini666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@bellini666
Copy link
Member

@zvyn there's just a small pyright issue that needs to be fixed, then it can be merged

@zvyn
Copy link
Contributor Author

zvyn commented Sep 11, 2023

@bellini666 thanks for the review! I'll take a look at the pyright issue later today

auto-merge was automatically disabled September 11, 2023 12:25

Head branch was pushed to by a user without write access

@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2023

Codecov Report

Patch coverage: 66.66% and no project coverage change.

Comparison is base (2a2723c) 87.99% compared to head (5bcdebf) 87.99%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #358   +/-   ##
=======================================
  Coverage   87.99%   87.99%           
=======================================
  Files          33       33           
  Lines        2940     2941    +1     
=======================================
+ Hits         2587     2588    +1     
  Misses        353      353           
Files Changed Coverage Δ
strawberry_django/fields/types.py 86.63% <50.00%> (+0.06%) ⬆️
strawberry_django/mutations/fields.py 86.16% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bellini666 bellini666 merged commit 54aba17 into strawberry-graphql:main Sep 11, 2023
35 checks passed
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

Successfully merging this pull request may close these issues.

3 participants