How can I model a field to accep structures of the form [{names: [String!]!, scope: String!}]?
I want to add to the existing model myModel, a new field x, which can store structures of the form [{names: [String!]!, scope: String!}].
I also have to model the graphql mutation to update myModel, but I don't know how. I thought about the following solutions, but they don't seem to be the best:
class myModel(models.Model):
x = ArrayField(JSONField(default=dict), default=list, blank=True, null=True)
class MyStructure(graphene.InputObjectType):
names = graphene.List(graphene.NonNull(graphene.String, required=True), required=True)
scope = graphene.String(required=True)
class UpdateMyModel(ClientIDMutation):
x = graphene.List(MyStructure)
# x = graphene.List(graphene.JSONString) ?
# x = graphene.List(GenericScalar) ?