From 5f7af3e43f91e8c4da82bce8ef880871463b53cd Mon Sep 17 00:00:00 2001 From: markus Date: Thu, 10 Nov 2016 10:00:59 +0000 Subject: [PATCH] Make node arg options and default required to True for GlobalID. --- graphene/relay/node.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphene/relay/node.py b/graphene/relay/node.py index c1bbe6d5..acaee3e4 100644 --- a/graphene/relay/node.py +++ b/graphene/relay/node.py @@ -35,9 +35,9 @@ def get_default_connection(cls): class GlobalID(Field): - def __init__(self, node, *args, **kwargs): - super(GlobalID, self).__init__(ID, *args, **kwargs) - self.node = node + def __init__(self, node=None, required=True, *args, **kwargs): + super(GlobalID, self).__init__(ID, required=required, *args, **kwargs) + self.node = node or Node @staticmethod def id_resolver(parent_resolver, node, root, args, context, info): @@ -52,7 +52,7 @@ class NodeMeta(InterfaceMeta): def __new__(cls, name, bases, attrs): cls = InterfaceMeta.__new__(cls, name, bases, attrs) - cls._meta.fields['id'] = GlobalID(cls, required=True, description='The ID of the object.') + cls._meta.fields['id'] = GlobalID(cls, description='The ID of the object.') return cls