Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
fix: make sure the correct node type is passed on inheritance with ot…
Browse files Browse the repository at this point in the history
…her types/interfaces implementing Node
  • Loading branch information
bellini666 committed May 19, 2023
1 parent 0c1fb6b commit 3d005c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "strawberry-django-plus"
version = "2.4.0"
version = "2.4.1"
description = "Enhanced Strawberry GraphQL integration with Django"
authors = ["Thiago Bellini Ribeiro <thiago@bellini.dev>"]
license = "MIT"
Expand Down
7 changes: 7 additions & 0 deletions strawberry_django_plus/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,13 @@ def _process_type(
cls,
)

# Adjust types that inherit from other types/interfaces that implement Node
# to make sure they pass themselves as the node type
for attr in ["resolve_node", "resolve_nodes", "resolve_id"]:
meth = getattr(cls, attr)
if isinstance(meth, types.MethodType) and meth.__self__ is not cls:
setattr(cls, attr, types.MethodType(cast(classmethod, meth).__func__, cls))

strawberry.type(cls, **kwargs)

# restore original annotations for further use
Expand Down

0 comments on commit 3d005c0

Please sign in to comment.