Frequently Asked Questions
How can I hide a field from GraphQL?
Strawberry provides a Private
type that can be used to hide fields from
GraphQL, for example, the following code:
will result in the following schema:
How can I deal with circular imports?
In cases where you have circular imports, you can use strawberry.lazy
to
resolve the circular imports, for example:
For more information, see the Lazy types documentation.
Can I reuse Object Types with Input Objects?
Unfortunately not because, as the GraphQL spec specifies, there is a difference between Objects Types and Inputs types:
The GraphQL Object type (ObjectTypeDefinition) defined above is inappropriate for reβuse here, because Object types can contain fields that define arguments or contain references to interfaces and unions, neither of which is appropriate for use as an input argument. For this reason, input objects have a separate type in the system.
And this is also true for Input types' fields: you can only use Strawberry Input types or scalar.
See our Input Types docs.
Can I use asyncio with Strawberry and Django?
Yes, Strawberry provides an async view that can be used with Django, you can Check Async Django for more information.