Skip to content

Name argument ignored in NodeField (Relay) #1083

Closed as not planned
Closed as not planned
@lucas-bremond

Description

@lucas-bremond

Looking at the node.py implementation:

class NodeField(Field):
    def __init__(self, node, type=False, deprecation_reason=None, name=None, **kwargs):
        assert issubclass(node, Node), "NodeField can only operate in Nodes"
        self.node_type = node
        self.field_type = type

        super(NodeField, self).__init__(
            # If we don's specify a type, the field type will be the node
            # interface
            type or node,
            description="The ID of the object",
            id=ID(required=True),
        )

the name argument is not passed to the super class.

Which means that:

CustomNode.Field(
        name = 'myCustomTypeName',
        type = MyCustomType,
        filterset_class = filters.MyCustomTypeFilter
)

does not create a myCustomTypeName type, but uses the default name.

Is there any reason for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions