Home > database >  Django graphene - mutation input without typing
Django graphene - mutation input without typing

Time:06-03

In mutation, I just need to save the event name and its payload that might differ and I do not need any validation for it. How can I say graphene that I just need to accept an object?

class SendEvent(MutationMixin, relay.ClientIDMutation):
    class Input:
        event = graphene.String(required=True)
        payload = # any object

CodePudding user response:

I hope you can use the GenericScalar(...)

from graphene.types.generic import GenericScalar


class SendEvent(MutationMixin, relay.ClientIDMutation):
    class Input:
        event = graphene.String(required=True)
        payload = GenericScalar(required=True)
  • Related