mirror of
https://github.com/atulmy/gql-query-builder.git
synced 2026-04-25 23:55:55 +03:00
[GH-ISSUE #92] How to add a field with arguments but with no inner fields to the GraphQL Query? #55
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/gql-query-builder#55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MurzNN on GitHub (Aug 1, 2024).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/92
I'm working with Commercetools API, here is the reference https://docs.commercetools.com/api/graphql
And it requires to add fields with arguments, here is an example:
The required fragment is
slug(locale: "en")and I can't find a way to make it using thegql-query-builderlibrary.If I use the operation without fields like this:
it produces an error:
Could you please give an example of how to build this query using the library? Thanks!
@MurzNN commented on GitHub (Aug 1, 2024):
I found two workarounds for this:
It produces almost what I need, but extracts the value to variables, instead of keeping it inline:
It produces the correct result:
but the problem is that I have to pass the arguments as the field name, that's no good.
So, if a correct solution for this task or better workarounds are present - please share!