Replace manual GraphQL string building with gql-query-builder #2007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 What
Swapped out the messy string concatenation for building GraphQL mutations with a proper query builder library. This follows GraphQL best practices by using structured query building instead of manual string formatting, making the code cleaner and less prone to syntax errors and injection.
💻 How
Added gql-query-builder as a dependency to handle GraphQL query construction. Refactored the
deploy_chain_atomicmethod to use the query builder instead of manually building strings, which provides better parameter handling by properly filtering out null values and handling optional parameters.🔬 Testing
Added a new test that validates complex GraphQL mutations with multiple dependencies. Updated existing tests to work with the cleaner query format, and all tests use regex to make sure the GraphQL structure is correct. Everything still works the same way from the outside.