Open miliakhaled opened 3 years ago
Hello, I'm sorry i found the solution. for those who encountered this problem, the solution is passing the serializer that matchs the nested fields.
class AffretementRessourcesSerializer(serializers.ModelSerializer):
class Meta:
model = models.AffretementRessources
fields = '__all__'
class CharteredLivraisonMutation(CustomDjangoSerializerMutation):
class Meta:
serializer_class = serializers.CharteredLivraisonSerializer
nested_fields = {"ressources": AffretementRessourcesSerializer}
Just as a reference to anyone else encountering a similar issue. I too had this issue, whilst using the DjangoInputObjectType
(rather than using DRF serializers).
I had specified a field inside nested_fields
but never defined a subclass of DjangoInputObjectType
that would be used for populating that model
Hello I need to create a mutation with nested fields and i couldn't find any example to follow, so my code is :
When i run this mutation, i get the following error:
I debugged the code a little bit, I found that the type of the nested_fields must be a dict, so i tried a dict {"ressources":?????} but whatever i wrote as a value for ressources (serializer model, graphql types, django model ...) , it does not work.