-
Notifications
You must be signed in to change notification settings - Fork 185
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
Add support for variable definitions in dsl #210
Add support for variable definitions in dsl #210
Conversation
Thanks! I'll look into it. |
Codecov Report
@@ Coverage Diff @@
## master #210 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 16 16
Lines 985 1041 +56
=========================================
+ Hits 985 1041 +56
Continue to review full report at Codecov.
|
This allows us to set variables deep inside input object
Your solution does not work with variables in input objects like this:
To solve this, the only way is to modify the recursive graphql-js itself is currently in the process of changing quite a few things (See graphql-js PR #3049) and changing the I̶'̶l̶l̶ ̶m̶a̶k̶e̶ ̶a̶n̶ ̶i̶s̶s̶u̶e̶ ̶o̶n̶ ̶g̶r̶a̶p̶h̶q̶l̶-̶j̶s̶ ̶s̶i̶d̶e̶ ̶t̶o̶ ̶d̶o̶ ̶t̶h̶i̶s̶ ̶a̶ ̶l̶i̶t̶t̶l̶e̶ ̶b̶i̶t̶ ̶c̶l̶e̶a̶n̶e̶r̶.̶ |
Oh, you're right! I missed that option. I agree that the only workaround is going to be copying the |
Looks good! I added some docs. Now for the hard part, could you please add tests so that the code coverage stays at 100% ? Note: if you want to avoid linting issues, you can run |
Great! Thank you @leszekhanusz. |
I added the tests and I think coverage is back to 100% again 🙂 |
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.
Great!
LGTM |
Thanks again for your PR! |
Hi all,
I was working in a small project and I needed a way to compose queries dynamically with variable definitions, so I can create the queries once depending on initial settings and just change the variables when sending them.
I created a
DSLVariableDefinitions
andDSLVariable
class in the dsl module to add the option. I tried to make it similar to the current API 🙂This is an example of how it works:
And it generates:
I have no experience with sphinx, please let me know if I need to adjust something.