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

Don't create custom literal parser by default #387

Merged
merged 5 commits into from
Jun 15, 2020

Conversation

rafalp
Copy link
Contributor

@rafalp rafalp commented Jun 14, 2020

I've did deep dive into GraphQL's query executor and found that if scalar has no literal parser, GraphQL executor will use default one, which did exactly what our default one, eg. convert AST value to python type, then call parse_value for field.

In this PR I've added tests cementing this behavior in the core, and removed our fallback default literal parser. I'll also open issue on our docs to remember to update that parse_literal is not required if your scalar doesn't need custom AST unpacking logic.

Fixes #371

@rafalp rafalp added enhancement New feature or request roadmap Feature that we want to have included labels Jun 14, 2020
@rafalp rafalp added this to the Ariadne 0.12 milestone Jun 14, 2020
@rafalp rafalp requested review from patrys and bogdal June 14, 2020 22:31
@rafalp rafalp self-assigned this Jun 14, 2020
@codecov
Copy link

codecov bot commented Jun 14, 2020

Codecov Report

Merging #387 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #387      +/-   ##
==========================================
- Coverage   98.16%   98.16%   -0.01%     
==========================================
  Files         105      105              
  Lines        5078     5063      -15     
==========================================
- Hits         4985     4970      -15     
  Misses         93       93              
Impacted Files Coverage Δ
ariadne/scalars.py 100.00% <ø> (ø)
tests/django/test_scalars.py 100.00% <ø> (ø)
tests/test_custom_scalars.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2afa112...df22705. Read the comment docs.

Copy link
Member

@bogdal bogdal left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@rafalp rafalp merged commit af8190d into master Jun 15, 2020
@rafalp rafalp deleted the fix-371-scalar-parser-with-variables branch June 15, 2020 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request roadmap Feature that we want to have included
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Argument 'code' has invalid value "ABC"
2 participants