graphene icon indicating copy to clipboard operation
graphene copied to clipboard

Name argument ignored in NodeField (Relay)

Open lucas-bremond opened this issue 4 years ago • 4 comments

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?

lucas-bremond avatar Oct 11 '19 19:10 lucas-bremond

Looks like a bug to me

BossGrand avatar Oct 31 '19 18:10 BossGrand

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 29 '20 22:01 stale[bot]

This is probably duplicate of #1035 but because it is still not released, it is issue for graphene v2.x

j123b567 avatar Dec 16 '20 09:12 j123b567

This is probably duplicate of #1035 but because it is still not released, it is issue for graphene v2.x

This is indeed the same thing... I'm going to request to have it merged into the v2 branch as well as other librairies are still depending on the v2

tcleonard avatar Jan 26 '21 14:01 tcleonard