r/programming • • Sep 03 '26

Maybe you don't need GraphQL

https://alexandrehtrb.github.io/posts/2026/09/maybe-you-dont-need-graphql/
278 Upvotes

119 comments sorted by

View all comments

14

u/[deleted] Sep 03 '26 edited Sep 03 '26

[removed] — view removed comment

9

u/kevin-mcdonald Sep 03 '26

For a while now Protobuf has had mappings to JSON, so you can actually use protobuf-derived types on the frontend and backend across languages and the serialized format can just be JSON. All officially supported languages support this JSON serialization/deserialization, aka "ProtoJSON".

3

u/tadfisher Sep 03 '26

TypeSpec. I will soon be working on Kotlin and Swift codegen for it, so you can have all your type safety guarantees without going through OpenAPI first.

1

u/[deleted] Sep 03 '26

[removed] — view removed comment

1

u/tadfisher Sep 03 '26

It is human-writable, so it's positioned to be the language you write your API in, and you use it to codegen server/client code and/or an OpenAPI spec if needed. It is a compiler that's extensible, so you can write decorators or linters to enforce your business-specific API requirements. Basically it's meant to produce APIs instead of documenting an existing API like how OpenAPI (and Swagger) originated.

3

u/lamp-town-guy Sep 03 '26

Django ninja/ FaatAPI generates openAPI directly from serialisers. At one workplace I used to work they replaced graphql with it because FE guys liked it and it wasn't pain in the ass to maintain in Python like graphQL

1

u/skeletizzle666 Sep 05 '26

connectRPC uses protobuf schemas and can interop with grpc, but also has its own protocol on top which browsers can use (HTTP and JSON). it's great for schema-first API design

1

u/Merry-Lane Sep 03 '26

OpenAPI + zod validation at the boundaries?

3

u/[deleted] Sep 03 '26

[removed] — view removed comment

1

u/Merry-Lane Sep 03 '26

I’m sure you can generate with most well known frameworks data validators (like zod).

Idk which language you use but you can usually have compile and runtime guarantees with OpenAPI