Skip to content

Propagate arguments of relay.NodeField to Field #1036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Pass all kwargs from NodeField to Field
  • Loading branch information
tdiam committed Aug 6, 2019
commit f96f08f5dc1da2e6045642ed5b79403bffd45d05
14 changes: 2 additions & 12 deletions graphene/relay/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,7 @@ def get_resolver(self, parent_resolver):


class NodeField(Field):
def __init__(
self,
node,
type=False,
deprecation_reason=None,
name=None,
description=None,
**kwargs
):
def __init__(self, node, type=False, **kwargs):
assert issubclass(node, Node), "NodeField can only operate in Nodes"
self.node_type = node
self.field_type = type
Expand All @@ -65,10 +57,8 @@ def __init__(
# If we don's specify a type, the field type will be the node
# interface
type or node,
name=name,
description=description,
deprecation_reason=deprecation_reason,
id=ID(required=True, description="The ID of the object"),
**kwargs
)

def get_resolver(self, parent_resolver):
Expand Down
2 changes: 1 addition & 1 deletion graphene/relay/tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_node_field_args():
field_args = {
"name": "my_custom_name",
"description": "my_custom_description",
"deprecation_reason": "my_custom_deprecation_reason"
"deprecation_reason": "my_custom_deprecation_reason",
}
node_field = Node.Field(**field_args)
for field_arg, value in field_args.items():
Expand Down