r/graphlinkdotdev • u/graphlinkdev • 3d ago
GraphLink 6.0: REST operations, Python and Go clients, and a stricter generator
I'm the author of GraphLink, an open-source CLI (glink) that reads a GraphQL schema and generates typed client and server code. The generated code has no runtime dependency on GraphLink. 6.0 is out today.
What's new:
Python and Go clients. Python has pydantic v2 models and an asyncio client. Go has plain structs and a context-aware client. That makes seven clients with Dart, Java, Kotlin, TypeScript and Swift.
REST operations in the same client. Put @glRest on a Query or Mutation field and the generated client calls it over HTTP/JSON. The call site is the same as for a GraphQL field. You can generate a typed client for an existing REST API and move to GraphQL one field at a time by removing the directive.
Scalar codecs. A custom scalar like Decimal or Money is converted on decode and encode. jsonType makes the decoder check the JSON type first, so a bad value becomes a clear error instead of a crash.
Stricter generator. Directives are validated, and bad responses fail with a clear error instead of returning null. Uploads now stream in every client instead of being built in memory.
Some of this is breaking, mainly Swift fromJson now throws, and unknown directives fail generation. The migration notes are at the end of the article.
Write-up: https://medium.com/@graphlinkdev/graphlink-6-0-rest-python-go-and-a-stricter-generator-b3be379127d5 GitHub: https://github.com/Oualitsen/graphlink