GraphQL
strict object type checking and reuse, an alternative to REST
Been knee deep in react lately, and went to another talk given at Facebook about graphql and relay - its implementation of flux. It’s interesting to look at some of these features compared to our implementation, which uses dropwizard, typesafe, react, and redux (flux).
Motivations
- More than simple and custom endpoints
- Request and response are the same shape
- Arbitrarily deep
- Mental model for product developers
Type system Type Query { Me: user }
Type user { Name: String Another: foo }
All the way down
- App server adverse what’s available, UI client request the shape that it wants
- Manages complexities of 52 weekly release to iOS and hit fixes in between, also multiple products so 1000s backward compatibility
Compositions an decomposition Fragment friend fragment on User { Name Events { Name } }
Not a storage engine, query language over the application code
Centralize complexity, promise API GraphQL sever advterises schema _schema object
Example against Swapi api
GraphQL server Type system plus sever - interacts with rest server
GraphQL editor, syntax checking evaluate graphQL and then code generate from the rest calls
Other Facebook products with relay externalize With react native native apps
Specifications RFC specification Express-graphql In 4 months it will be back ported into Facebook
Other Open source products Graphql-ruby Graphql-Java Rx
React Functional programming Immutable data structure Declarative API Opinionated platform Learn once and write anywhere, js, Java, hack
React native for iOS and android Relay horizontal platform to interact with react and graphql
Q&A Deprecation Add manufactured field and manufactured connection and deprecate a field
Bias toward one mega schema. The entire Facebook app is built on one schema.
Backend developer map out types and turn into GraphQL type designers
persistent queries in the serverside
It doesn’t support aggregations
- Intentionally leaving out
- Can add fields to add aggregations to opt in backend and middle tier developers to advertise this
Graph sever orchestration Direct externalizations of M query Antonette query?
Mapping Class and field types to backend
Centralized mutations