Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Mauricio Reatto Duarte
Mauricio Reatto Duarte

Posted on

     

Production Ready GraphQL Summary — Part I

I'm reading thisbook with GraphQL content.

Thanks@leonardomso

book

Pagination: Cursor Pagination

  • Cursor pagination is generally a great choice, because of the accuracy and performance
  • Maybe it's the most common pattern in GraphQL at the moment
  • This pattern lets us design more complex use cases, because of Connection and Edge types
  • Relay clients integrate perfectly with your API because of that

Global Identification: Global ID — Node

  • Like Connections, they can be a good pattern even outside of a Relay context
  • Opaque IDs are recommended
  • You necessarily don't need global identification if you're not planning to use Relay
  • Ensure your global identification contains enough context to globally route to a node, especially in a distributed architecture

Non-Nullability

  • It lets clients avoid defensive code/conditionals
  • It helps to build more predictable schemas

tradeoffs/warnings:

  • It's very hard to predict what can be null
  • Non-null fields and arguments are harder to evolve. Going from non-null to null is a breaking change, but the opposite is not

guidelines for nullability:

  • Should almost always nullable fields that return object types that are backed by database associations, network calls, or anything that could potentially fail
  • Non-null for arguments, because it's more predictable and easy to understand API

That's it.
My first part of the book summary. Thank you.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Software Engineer
  • Work
    software engineer
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp