Questions tagged [strawberry-graphql]

Questions related to usage of Strawberry, a Python Library for creating GraphQL APIs using type hints in Python.

50 questions
0
votes
2 answers

How Can I pass dictionary data as a input to the fast api strawberry mutation?

My input data: {"Nepal": "Kathmandu", "Italy": "Rome", "England": "London"} Goal: I want to pass above data as a input to the strawberry mutation. It seems currently, strawberry is not supporting dict type. I found JSON type but if i want to use…
siva
  • 549
  • 7
  • 25
0
votes
0 answers

How can I create fastapi strawberry mutation with nested data structure as input and output

Using Python's fast-api, I implemented a POST endpoint which will take request body something like below and will do some sort of processing and will return resultant dictionary to the client as shown below. RequestBody:(user details) { "0": { …
siva
  • 549
  • 7
  • 25
0
votes
0 answers

How do I define mongoengine DynamicField in strawberry graphql schema

mongo-model.py `class DataRecord(EmbeddedDocument): field = StringField() old = DynamicField() new = DynamicField() class Audit(BaseModel): data = EmbeddedDocumentListField(DataRecord)` [graphql-schema] `@strawberry.type class…
0
votes
1 answer

get the path of a specific field in a graphql query

I want to get the path of a specific parameter of a graphql query and return it as a list. for example, there is query like this: query = ''' query { books { __typename title } users { …
0
votes
0 answers

GraphQL - Adding second database table is not working - import in controllers/index.py unused

I set up a project following this tutorial in YouTube: https://www.youtube.com/watch?v=nynySD0WoYQ In this tutorial, GraphQL is used with FastAPI and the strawberry library. Furthermore, docker is used in order to create and connect with MySQL…
Tobitor
  • 1,388
  • 1
  • 23
  • 58
0
votes
0 answers

django strawberry query choice field values

I am using strawberry graphql for my project. I have a form field where I need to show options from my choice fields. I have a model like class Product(models.Model): REQUIREMENT_CHOICES = ( ("N", "New"), ("O", "Old"), ("M",…
rudra
  • 61
  • 4
0
votes
0 answers

Extract header from GraphQL response, over websocket transport

I have a client and server that communicate with GraphQL over websocket transport. Everything is written in python: On the client side I use the gql package, and on the server side I use the strawberry packge. I want to add a custom header for the…
0
votes
1 answer

GraphQL Strawberry Shake client execution strategy

I built a HotChocolate service and a strawberry client according to the documentation on the chillcream website. Here is my client code: namespace strawberry_shake_graphql_client { internal class Program { static IServiceCollection…
Siraf
  • 1,133
  • 9
  • 24
0
votes
0 answers

Strawberry with social_django

How can I use social_django with strawberry graphql? With graphene, I inherited my strawberry.type from SocialAuthJWT I used in grapgene like this. class SocialAuth(graphql_social_auth.SocialAuthJWT): user = graphene.Field(UserType) …
Kirill
  • 43
  • 4
0
votes
0 answers

Can the same graphql schema be used across multiple strawberry fastapi routers?

I have strawberry setup to run with fastapi. Basically, like the examples, the fastapi initialization code creates a GraphQLRouter with a Schema object and a context_getter. Everything works great, I use __get_context to pass some Dependencies…
Mark Rogers
  • 96,497
  • 18
  • 85
  • 138
0
votes
0 answers

Subscriptions in Strawberry GraphQL + FastApi

I'm trying to set up a minimal GraphQL service that redirects Rest Post messages to subscribers. I see Strawberry GraphQL, together with FastApi can help me to do the job done, but I can't find any resource shows how to set up the subscription…
Reza
  • 43
  • 7
0
votes
1 answer

GraphQL Python Strawberry refactor common types

I am using Python 3.10 and Strawberry 0.139 Is there any way to refractor out like-terms to write less code for defining types? Lets say I have two types in my schema @strawberry.type class Home(Address): name: str location: str …
ccsv
  • 8,188
  • 12
  • 53
  • 97
0
votes
0 answers

How to create session in Graphql in fastapi to store token safely after generating the token by mutation?

I am using strawberry graphql and fastapi. I created a token from mutation , how can I store the token in session(backend) and send session id to the cookies. how can I retrieve the token from session in graphql query.
0
votes
0 answers

How to use dataLoader in strawberry(Fast API, Sqlalchemy)

I have these three model. One user have multiple roles.I am stuck for get roles of user. How can I get the user with roles using strawberry dataloader? class UserRole(Base): __tablename__ = "user_roles" id = Column(Integer,…
0
votes
1 answer

Strawberry GraphQL Django limiting filtering options in GraphiQL interface

So I have two graphql filters for a foreign key that works in Strawberry GraphQL Django v0.31. @strawberry.django.filters.filter(models.Client, lookups=True) class ClientFilter: id:auto …
ccsv
  • 8,188
  • 12
  • 53
  • 97