Open stygmate opened 4 months ago
Can you give more information about this, with examples if possible?
@bellini666
with this query:
query MyQuery {
param {
equip {
edges {
node {
id
}
}
}
}
}
this don't work:
@strawberry.type
class Param:
equip: ListConnectionWithTotalCount[types_.Equip] = strawberry_django.connection()
@strawberry.type
class Query:
param: Param = strawberry.field()
but this (with a custom resolver) work :
@strawberry.type
class Param:
equip: ListConnectionWithTotalCount[types_.Equip] = strawberry_django.connection()
@strawberry.type
class Query:
@strawberry.field()
def param(self, info) -> Param:
return Param(equip=types_.Equip.__strawberry_django_definition__.model.objects)
( i get the model manager from strawberry_django_definition 🤪 but i think you have it )
Is Param
a django type? In your example you wrote it as @strawberry.type
, but if it is using @strawberry_django.type(ParamModel)
, then you can do:
@strawberry.type
class Query:
param: Param = strawberry_django.field()
# or if you are using relay and Param inherits from Node
param: Param = strawberry_django.node()
Let me know if that works
@bellini666
No, Param
is not a Django type, there's no django model named Param.
param
field (using Param
type) is meant to be a "folder" to better organize related fields of my api.
@bellini666 i see that you have taged this "help wanted", I renamed this issue by adding ("folders" to better organize related fields)
to make it more understandable.
Is there a simple way to move fields that are in base Query Into subfields to namespace/organize them ? (I keep running into issues. 😓)
Upvote & Fund