Questions related to usage of Strawberry, a Python Library for creating GraphQL APIs using type hints in Python.
Questions tagged [strawberry-graphql]
50 questions
7
votes
2 answers
c# .net build error due to strawberry shake graphql client error - "access to the path 'obj\\berry' is denied"
Recently I updated my visual studio to the latest version of 17.5.1 and my target sdk version is NET 7.0 SDK (v7.0.102). Now I have a build error stating that "access to the path 'obj\berry' is denied". Anyone got the same error and suggestion to…

Hash_Dew
- 313
- 1
- 8
6
votes
1 answer
In a new project, Graphene or Strawberry? Why?
which lib is better to integrate with a new django project?
i red the docs and still doesnt know how performatic or easier to integrate each one can be in prod environment.
i used graphene before to integrate with some pipefy code that i did at work…

pdrferrari
- 65
- 6
6
votes
2 answers
GraphQL Code Generator - Failed to load schema from http://localhost:8000/graphql - Request with GET/HEAD method cannot have body
I've built a GraphQL API using strawberry and strawberry-django-plus that is hosted on http://localhost:8000/graphql using Django. I am able to successfully interact with the API using GraphiQL on the localhost page.
I'm now trying to access the…

sebtheiler
- 2,159
- 3
- 16
- 29
3
votes
1 answer
How to put permissions on input fields in strawberry GraphQL?
I found a way to set permissions on starwberry type fields like this:
@strawberry.type
class SomeModel:
id: strawberry.ID
login: Optional[str] = strawberry.field(permission_classes=[Permission])
But when I try to put the same logic on input…

Oleg Korkeshko
- 43
- 3
3
votes
1 answer
How to require django's authentication on strawberry-graphql
I want to require django's user authentication in order to access the graphql view.
My first attempt was to decorate the view with login_required:
from django.contrib.auth.decorators import login_required
from django.urls import path
urlpatterns =…

fabien-michel
- 1,873
- 19
- 38
3
votes
2 answers
Get requested fields in Strawberry GraphQL Resolver
How we can get requested fields in Strawberry GraphQL Resolver
query {
test {
label
}
}
How can I get the label field in the resolver?
I have tried:
info.field_nodes[0].selection_set.selections
But it is not returning what I want

ALTAF HUSSAIN
- 205
- 2
- 13
3
votes
1 answer
Check Permissions in FastAPI + Stawberry GraphQL
I'm using BasePermission decorator as specified in documentation.
@strawberry.type
class Query:
@strawberry.field(permission_classes=[IsAuthenticated])
def user(self) -> User:
# get by token OFC
return User(user_id=1,…

Vladimir Stazhilov
- 1,956
- 4
- 31
- 63
2
votes
6 answers
C# .Net build failure due to strawberryshake error - Method not found: 'Void StrawberryShake.CodeGeneration.CSharp.CSharpGeneratorSettings
I have a .net 6 project which uses strawberryshake 12.18.0 grahpql client. It build in my local environment. But when it runs in Azure pipeline it fails to build the project due to below error.
Error SS0006: Method not found: 'Void…

Hash_Dew
- 313
- 1
- 8
2
votes
1 answer
How to filter based on child resolvers?
I'm starting to get deeper into Strawberry than a simple Hello World, and am struggling in part for lack of insight into the execution engine.
My understanding is that the strawberry resolvers are just static methods, and the strawberry engine goes…

Matt
- 21
- 2
2
votes
1 answer
Fastapi with strawberry is returning Error "'dict' object has no attribute 'name'"
I am trying to get character fields from the api rest of Rick&Morty using graphql with Fastapi + StrawBerry and i always get the same error with the first field i write
my code:
from fastapi import FastAPI
import strawberry
from strawberry.fastapi…

Cristoff
- 149
- 6
2
votes
2 answers
Сombine mutations in one in Strawberry Graphql
How to combine mutations in one?
@strawberry.type
class Mutation1:
@strawberry.mutation
def login(self, email: str, password: str) -> LoginResult:
@strawberry.type
class Mutation2:
@strawberry.mutation
def create_post(self, title:…

Kirill
- 43
- 4
2
votes
1 answer
Strawberry+FastAPI: How to get request-info in a dependency?
Consider this code:
import strawberry
from fastapi import FastAPI, Depends, Request, WebSocket, BackgroundTasks
from strawberry.types import Info
from strawberry.fastapi import GraphQLRouter
def custom_context_dependency() -> str:
# ===> need…

npk
- 1,512
- 1
- 13
- 26
2
votes
1 answer
To run a GraphQL server in Python that allows queries and subscriptions, do I have to combine it with a web framework service?
Excuse my ignorance in this area: most of my programming has been in optimization and research. I am very new to GraphQL and client-server programming.
My organization is working on an automated scheduler in Python 3.9 for scheduling observations…

Sebastian
- 715
- 6
- 13
2
votes
1 answer
Strawberry GraphQL return dict
I want to create a mutation which takes a dict as an argument. There are implementation-specific reasons to want to do this, instead of creating a type/schema for the dict object.
Object
# types.py
import typing
@strawberry.type
class Thing:
…

Inigo Selwood
- 822
- 9
- 20
2
votes
0 answers
Generic container type with Strawberry GraphQL
I want to create a generic Strawberry type for a pagination result:
T = TypeVar('T')
@strawberry.type
class CursorPaginationResult(Generic[T]):
rows: List[T]
next: str
This seems to work but i would like CursorPaginationResult to be a…

cbergmiller
- 278
- 1
- 10