remorses / genql

Type safe TypeScript client for any GraphQL API
https://genql.dev
MIT License
881 stars 37 forks source link

Allow executing against in memory schema #154

Closed jasonkuhrt closed 9 months ago

jasonkuhrt commented 11 months ago

I keep returning to this great library :) Thanks @remorses

We would like to try genql against an in-memory schema. Not network. Right now the client makes the assumption that the schema will be used over HTTP. We'd like a way to pass in a schema directly instead.

remorses commented 11 months ago

You can override the fetch function to do what you want

https://genql.dev/docs/usage/create-the-client#60b057b56b1340b099732ced94b26571

jasonkuhrt commented 11 months ago

@remorses Good workaround, makes sense. I still think first class support for direct schema would make sense, it is after all actually simpler and lower level than fetch over network. Bit ironic to override fetch to access the graph in memory :))

remorses commented 9 months ago

I am going to keep fetch as most people are already familiar with it, instead of adding another option