-
Notifications
You must be signed in to change notification settings - Fork 183
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
Refactor DSL code #169
Refactor DSL code #169
Conversation
Adding type annotations Replace selections generator by get_ast_fields function Remove ast property Replace serialize_list method by a lambda Remove obsolete test_nested_input_with_old_get_arg_serializer test
Move get_arg_serializer function inside the DSLField class Rename get_field method of DSLType to _get_field
DSLSchema now requires a schema instead of a client query and mutate methods of DSLSchema have been replaced by a gql method which will return a DocumentNode
Set get_ast_field as a staticmethod of the DSLField class
Move DSLSchema.gql method out of the class to the dsl_gql funciton Add a test_multiple_queries test
Put the _get_field method of DSLType inside __getattr__
The GraphQL type is saved in each DSLField This allows us to compute the operation directly from the fields (no need for the operation argument anymore) In dsl_gql, we check that all the fields have the correct type and that they are root fields (Query, Mutation and Subscription) Add new AttributeError for types which are not in the schema Replacing the KeyError by an AttributeError in the __getattr__ method of DSLType Adding debug log messages when creating fields and types
Codecov Report
@@ Coverage Diff @@
## master #169 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 14 14
Lines 939 946 +7
=========================================
+ Hits 939 946 +7
Continue to review full report at Codecov.
|
I'll add documentation tomorrow before merging |
Rename known_serializers to known_arg_serializers
Added __repr__ dunder methods to DSLType and DSLField Added debug logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outstanding work @leszekhanusz
Also it seems you also fixed #104, right?
Adding executable examples for async and sync clients Added to README.md features
Thanks 😄
No, this is not related, #104 is not using the DSL module at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks great, although I have made the alias change to work locally and tested it without any issue, should I push the commit to this branch so everything gets merged on one shot?
Done 🍰
I can't believe it 🤦♂️ , the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, I loved the latest changes and the operation name feature :D
Refactoring of the DSL code.
dsl_gql
function to convert the DSL operations into a DocumentSimple example: