This article has been originally posted on my Medium account here
Day 1
Below are my takeaways from Day 1 of the GraphQL conference which took place in Berlin/Germany. Amazing talks by fantastic speakers!!
Dan Schafer’s talk — GraphQL before GraphQL
Everything has to be coded to be async — even when you think it’s not needed to be async, still make it async.
Resolvers have to be async
GraphQL was never meant to solve for Authorization, Caching of results, below, rate Limiting when it was developed
Resolvers should be thin and should only map to business logic and not contain actual business logic
Sashko Stubailo explained how easy it is to build custom GraphQL tooling for specific use-cases
- Write tests with less boilerplate code and ability to write custom overrides for testing edge cases, error states using this graphql-tools. Read more here.
- Preventing a breaking change by checking if a GraphQL field is being referenced or not. Read about it here
Sasha Solomon talked about the errors array in GraphQL response and how to deal with them in a better manner.
- All errors end up in the errors array, but not all errors are the same.
Some of them are real errors like server not available, bad gateway but others like might just be ‘alternative results’ like a blocked user, suspended user, etc.
To differentiate errors like above, use union types and basis the type in response, the client can decide what to do.
union UserResult = User| IsBlocked | Suspended
The key thing is not to create too many types and keep it only to important ones.
This talk was easy to grasp and implement at the get-go :)
Best Practices around migrating to GraphQL
- Think about making incremental changes, edge cases and ability to safely rollback
- Build adaptors for easy migration Automated test suites are super important to do this herculean task
Marc-André Giroux’s talk about distributing schemas in GraphQL
- Always ask the question if distributing schemas is really necessary?
- Schema stitching helps us achieve schema distribution but business logic often leaks into the API gateway and it ends up being more complex than just simple “proxying” Ideally an API gateway should be like below:
- Decouple” the clients from the “services” involved in the use cases
- Avoid domain logic
- Schemas should be easy to import in the gateway Talk slides here.
This was my attempt to write down what was captured in my notebook and brain :D
I will be writing another blog post about learning from Day 2. Stay tuned!
Top comments (0)