Hacker News new | past | comments | ask | show | jobs | submit login

> REST is a PITA for any data model that’s more complex than CRUD.

Also I'd just like to point out that for everything but queries themselves, GraphQL uses JSON. JSON is used in the C and U of GraphQL's CRUD... Explain to me why this couldn't have just been JSON and therefore a REST API again..?

Almost the only thing stopping it from being one is its "query language". I guess technically usage of one endpoint would make OpenAPI doc'ing difficult but I think possible depending on what JSON Schema/OpenAPI version you're using.

But it would also be trivial to just have separate endpoints for each schema.

You could even use all POST requests and only use the request body if you want.




> Also I'd just like to point out that for everything but queries themselves, GraphQL uses JSON.

Most clients send queries as json too, actually, not gql source. The funny thing is that GraphQL doesn't even specify JSON, or any wire format at all. It just has to be able to encode the gql type system, and JSON "just happens" to work (I'm pretty sure they did have json in mind when they wrote it, but it still isn't baked into the spec). The spec is also silent on transport, I think the whole tunneling-everything-through-POST thing came from the reference implementation.

You really seem attached to OpenAPI. I can't speak for everyone, but I for one would would much rather write SDL than json schema in yaml.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: