Khan / genqlient

a truly type-safe Go GraphQL client
MIT License
1.02k stars 99 forks source link

Add option for including operationName as a query parameter #298

Open cgetzen opened 6 months ago

cgetzen commented 6 months ago

This introduces the ability to include operationName as a query parameter for the default client.

There are a few patterns for options that are described here. The existing NewClientUsingGet follows the "Declare a new constructor for each configuration option" pattern. As additional options get added, the "Functional Options Pattern" may be more scalable.

Use-case: This allows requests to be routed based on their operation.

I have:

cgetzen commented 6 months ago

Hi @StevenACoffman

The lint failures seem unrelated to this PR. I am also unable to trigger these errors locally with:

docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.52.2 golangci-lint run -v

Do you have any guidance on what could be going wrong? Thanks!

benjaminjkraft commented 6 months ago

Ah, and I'm not sure what's up with the lint. I agree it looks off, but I don't have time to figure out why right now. Perhaps we should try updating the linter -- feel free to give that a go in a separate PR if you like!

benjaminjkraft commented 4 months ago

Lint is fixed in #311 so once you merge main that part should be good!