This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This gist shows how to speed up graphene_django by short-cutting the field and type resolution of the returned JSON and | |
# using a bit of caching to avoid having to repeat our discovery/decision process across multiple fields of the same | |
# type. It relies on trusting the developer to always return the correct types and respect non-nullability. | |
# Assumes that: | |
# 1. You're not using async code | |
# 2. You're using graphql_sync_dataloader to solve the N+1 problem | |
# 3. You're not using any graphene middleware other than for authentication | |
# 4. Your resolvers will all respect the schema | |
# 5. See code comments for further limitations |