mirror of
https://github.com/graphql-python/graphene.git
synced 2025-09-21 11:22:33 +03:00
Pass all kwargs from NodeField to Field
This commit is contained in:
parent
2c0e044e2a
commit
f96f08f5dc
|
@ -48,15 +48,7 @@ class GlobalID(Field):
|
||||||
|
|
||||||
|
|
||||||
class NodeField(Field):
|
class NodeField(Field):
|
||||||
def __init__(
|
def __init__(self, node, type=False, **kwargs):
|
||||||
self,
|
|
||||||
node,
|
|
||||||
type=False,
|
|
||||||
deprecation_reason=None,
|
|
||||||
name=None,
|
|
||||||
description=None,
|
|
||||||
**kwargs
|
|
||||||
):
|
|
||||||
assert issubclass(node, Node), "NodeField can only operate in Nodes"
|
assert issubclass(node, Node), "NodeField can only operate in Nodes"
|
||||||
self.node_type = node
|
self.node_type = node
|
||||||
self.field_type = type
|
self.field_type = type
|
||||||
|
@ -65,10 +57,8 @@ class NodeField(Field):
|
||||||
# If we don's specify a type, the field type will be the node
|
# If we don's specify a type, the field type will be the node
|
||||||
# interface
|
# interface
|
||||||
type or node,
|
type or node,
|
||||||
name=name,
|
|
||||||
description=description,
|
|
||||||
deprecation_reason=deprecation_reason,
|
|
||||||
id=ID(required=True, description="The ID of the object"),
|
id=ID(required=True, description="The ID of the object"),
|
||||||
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_resolver(self, parent_resolver):
|
def get_resolver(self, parent_resolver):
|
||||||
|
|
|
@ -114,7 +114,7 @@ def test_node_field_args():
|
||||||
field_args = {
|
field_args = {
|
||||||
"name": "my_custom_name",
|
"name": "my_custom_name",
|
||||||
"description": "my_custom_description",
|
"description": "my_custom_description",
|
||||||
"deprecation_reason": "my_custom_deprecation_reason"
|
"deprecation_reason": "my_custom_deprecation_reason",
|
||||||
}
|
}
|
||||||
node_field = Node.Field(**field_args)
|
node_field = Node.Field(**field_args)
|
||||||
for field_arg, value in field_args.items():
|
for field_arg, value in field_args.items():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user