Comments (8)
Hey @gersmann ,
Hrm, I'm trying to replicate the issue here but it is working fine for me. The schema shows as not required and I can not send service
at all to the input and it will work. It will not work if the field cannot be null though, for obvious reasons.
Can you provide more information regarding this? Like, the traceback itself, how are you doing the mutation, etc?
from strawberry-django-plus.
@bellini666 you're right, not sure how that schema came to be, I didn't reproduce the problem correctly. It happens when inheriting a base type, this should reproduce it:
@gql.django.input(ServiceInstance)
class ServiceInstancePartialInput(NodeInput):
id: gql.ID
service: Optional[OneToManyInput]
key: Optional[str]
@gql.django.input(Connector)
class ConnectorPartialInput(ServiceInstancePartialInput):
pass
@gql.type
class ServiceMutation:
update_connector: ConnectorType = gql.django.update_mutation(ConnectorPartialInput)
{
"data": null,
"errors": [
{
"message": "Field 'ConnectorPartialInput.service' of required type 'OneToManyInput!' was not provided.",
"locations": [
{
"line": 18,
"column": 25
}
],
"path": null
}
]
}
Stack:
edit: removed
from strawberry-django-plus.
Noticed that inheritance behaves a bit strange in general, for instance if case a Django foreign key relationship is inherited, it is represented by the generic DjangoModelType
, but if it is defined directly on the child type, it is represented by the correct concrete GraphQL type.
from strawberry-django-plus.
Hey @gersmann ,
You are calling your types Partial
, but you are using gql.django.input
on them instead of gql.django.partial
(or even gql.django.input(partial=True)
). That may be the issue with it being required.
Noticed that inheritance behaves a bit strange in general, for instance if case a Django foreign key relationship is inherited, it is represented by the generic DjangoModelType, but if it is defined directly on the child type, it is represented by the correct concrete GraphQL type.
Don't know if I understood what you meant here... Could you provide an example of that too?
from strawberry-django-plus.
sorry for the screenshots, haven't been able to export the schema with django yet (apps aren't ready...)
So this definitiion:
@gql.django.type(Customer)
class CustomerType:
id: gql.auto
name: gql.auto
@gql.django.type(ServiceInstance)
class ServiceInstanceType:
customer: CustomerType
@gql.django.type(Connector)
class ConnectorType(ServiceInstanceType):
pass
@gql.type
class Query:
service_instances: List[ServiceInstanceType] = gql.field()
connectors: List[ConnectorType] = gql.field()
Gives me for ServiceInstanceType
:
Thats what I meant this inheritance behaving a bit strange.
from strawberry-django-plus.
This here replicates the original issue, also seems like it is inheritance-related:
@gql.django.input(ServiceInstance)
class ServiceInstanceInput:
service: Optional[OneToManyInput]
@gql.django.input(Connector)
class ConnectorInput(ServiceInstanceInput):
updated_at: gql.auto
@strawberry.type
class Mutation:
create_service_instance: ServiceInstanceType = gql.django.create_mutation(ServiceInstanceInput)
create_connector: ConnectorType = gql.django.create_mutation(ConnectorInput)
from strawberry-django-plus.
Hey @gersmann ,
Think I found the issue. Should be fixed in the release I'm doing right now. Please reopen this issue if it is not
from strawberry-django-plus.
@bellini666 Thanks a lot.
from strawberry-django-plus.
Related Issues (20)
- Querying both sides of a OneToOneField at the same time is an error HOT 5
- Can't make a union of `gql.Connection | OperationMessage` HOT 1
- Headers are not passed to `self.client.post` in `TestClient.request` HOT 1
- Can't make a union of `gql.Connection | OperationMessage` (part 2) HOT 9
- clash with the novel strawberry.relay module (GlobalId)
- relay: compatibility with the new strawberry.relay module HOT 2
- more SQLs then expected HOT 6
- need for an async resolvers.update HOT 1
- NameError with lazy types in relay connection annotations
- input_mutation: TypeError: MutateContentInput fields cannot be resolved HOT 9
- filters not showing up HOT 1
- Optimise manually prefetched field HOT 1
- Got an unexpected keyword argument 'filters' HOT 2
- NodeExtension broken with Strawberry HOT 1
- class inheritance not being detected? HOT 8
- hard dependency on contenttypes framework in optimizer
- hard dependency on django.contrib.auth HOT 1
- Using input_mutation with a None return type throws an exception HOT 1
- Query resolution is really slow HOT 15
- This repo has been merged into strawberry-graphql-django and it is now deprecated HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strawberry-django-plus.