Live data from Hacker News

GraphQL vs. REST APIs: a complete guide

airplane.dev

101–103 of 103 posts

Re: GraphQL vs. REST APIs: a complete guide

#101

GraphQL is extremely useful, if only to have strong type validation between disparate languages, via code generation. It can be a universal typed schema of your data against which you can use whatever server and client combo you want. It's like tRPC but you're not forced to use only TypeScript. I also have to plug this video [0], since many people think GraphQL somehow is a competitor to SQL and that it goes between…

> strong type validation

The limited types in GraphQL kinda make that not very helpful. A RESTful API with JSON Schema or zod schema for it has much stronger types, and you can even make converting to better types be part of the zod schema.

Re: GraphQL vs. REST APIs: a complete guide

#102

GraphQL is extremely useful, if only to have strong type validation between disparate languages, via code generation. It can be a universal typed schema of your data against which you can use whatever server and client combo you want. It's like tRPC but you're not forced to use only TypeScript. I also have to plug this video [0], since many people think GraphQL somehow is a competitor to SQL and that it goes between…

> strong type validation The limited types in GraphQL kinda make that not very helpful. A RESTful API with JSON Schema or zod schema for it has much stronger types, and you can even make converting to better types be part of the zod schema.

> A RESTful API with JSON Schema

Sure but I get it for free with GraphQL anyway.

> you can even make converting to better types be part of the zod schema

I'm not using TypeScript so this wouldn't be useful to me. That's why I mentioned that GraphQL is good for disparate servers and clients that aren't necessarily just React/Node/TypeScript.

Re: GraphQL vs. REST APIs: a complete guide

#103
post #88

Earlier quoted context omitted.

I love graphql. It allowed me to scrape a whole bunch of websites with almost no changes to my scraper.

How is this different than a REST API with an open api spec? I suppose GraphQL APIs are just more likely to have introspection turned on since it’s the default?

> with almost no changes to my scraper

Thats the killer feature.

Post reply on HN