timkendall / tql

A GraphQL query builder for TypeScript. Avoid the pain of codegen.
https://tql.dev
MIT License
133 stars 6 forks source link

Make Selection#toString returns string representation of complete operation #122

Closed lorefnon closed 1 year ago

lorefnon commented 1 year ago

Selection#toString currently returns the string representation of selectionSet which is weird for anything other than query.

I was using it with graphql-ws, passing the outcome of toString() to subscribe, which worked for queries, but started failing for mutations because in absense of operation type server defaults to Query type.

I propose that toString basically be the string analogue of toQuery.

This is a breaking change in behavior, but I don't think many people would be using toString for mutations/subscriptions etc. as the current output would need some postprocessing before it can be used.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
tql ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 15, 2023 at 7:27AM (UTC)