Skip to content

@validated decorator is incompatible with Relay mutations #10

Description

@akikoskinen

Relay mutations are those inherited from graphene.relay.ClientIDMutation. To reproduce, add this code to tests.py and try to run tests:

@validated
class RelayMutation(graphene.relay.ClientIDMutation):
    @classmethod
    def mutate_and_get_payload(cls, root, info, **_inpt):
        return RelayMutation()

An error is produced already in the import phase. Output could look something like this:

tests.py:117: in <module>
    class RelayMutation(graphene.relay.ClientIDMutation):
graphene_validator/decorators.py:143: in validated
    class Wrapper(cls):
.venv/lib64/python3.7/site-packages/graphene/utils/subclass_with_meta.py:52: in __init_subclass__
    super_class.__init_subclass_with_meta__(**options)
.venv/lib64/python3.7/site-packages/graphene/relay/mutation.py:34: in __init_subclass_with_meta__
    input_fields, client_mutation_id=String(name="clientMutationId")
E   TypeError: Cannot create a consistent method resolution
E   order (MRO) for bases InputObjectType, RelayMutationInput

Graphene's Relay code does some meta class magic and dynamically produces various classes and at some point it manages to create a cyclic dependency chain between classes and thus Python can't create an MRO.

I have no idea how to solve this. The meta class magic in Graphene looks too complex to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions