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

Parse custom scalar and enums in outputs #256

Merged
merged 22 commits into from
Nov 22, 2021

Conversation

leszekhanusz
Copy link
Collaborator

@leszekhanusz leszekhanusz commented Nov 19, 2021

Adding parse_results functionality

If you add parse_results=True to the Client init,
or if you add parse_result=True to the execute or subscribe methods,
then gql will unserialize the result received from the backend with the scalars defined in the schema.

Note: because graphql-core PR 138 is not yet in a stable release, you might have issues with enums (parsed to None) if you get your schema from introspection.

New utilities method to update the schema

  • update_schema_enum to update an Enum in the schema
  • update_schema_scalar to update a Scalar in the schema

@leszekhanusz

This comment has been minimized.

@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2021

Codecov Report

Merging #256 (1e6ff7f) into master (d1ba78d) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #256    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           19        21     +2     
  Lines         1436      1650   +214     
==========================================
+ Hits          1436      1650   +214     
Impacted Files Coverage Δ
gql/client.py 100.00% <100.00%> (ø)
gql/utilities/__init__.py 100.00% <100.00%> (ø)
gql/utilities/parse_result.py 100.00% <100.00%> (ø)
gql/utilities/serialize_variable_values.py 100.00% <100.00%> (ø)
gql/utilities/update_schema_enum.py 100.00% <100.00%> (ø)
gql/utilities/update_schema_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 d1ba78d...1e6ff7f. Read the comment docs.

+ fix custom scalars serializing as lists
@leszekhanusz leszekhanusz changed the title Parse custom scalar in outputs Parse custom scalar and enums in outputs Nov 22, 2021
@leszekhanusz leszekhanusz merged commit 46252d1 into graphql-python:master Nov 22, 2021
@leszekhanusz leszekhanusz deleted the feature_parse_results branch March 12, 2022 12:43
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.

2 participants