Company
Date Published
Author
Sashko Stubailo
Word count
1012
Language
English
Hacker News points
None

Summary

A well-documented REST API provides less useful information than a GraphQL schema, which is inherently self-documenting and allows for easy traversal of relationships between objects. A GraphQL server defines types and connections between them, making it easier to express queries and traverse data in natural ways. This approach powers developer experiences like GraphiQL, an auto-completing query UI. In contrast, well-documented REST APIs often lack the ability to easily call multiple endpoints based on relationships between objects, leading to the idea that GraphQL could leverage existing information to add missing relationships and enable easier API querying. The author applied a few "hacks" to transform a Star Wars API schema into a GraphQL-JS schema, demonstrating its potential productivity benefits over REST APIs.