📝 UnsolvableAnnotationsError when subclassing a concrete Controller subclass` (#873)
What's wrong?
Bug:
UnsolvableAnnotationsError when subclassing a concrete Controller subclassDescription
When creating an intermediate concrete controller class and then subclassing it,
__init_subclass__ raises UnsolvableAnnotationsError even though the serializeris already resolved on the parent.
Reproduction
from dmr import Controller
from dmr.plugins.pydantic import PydanticSerializer
from dmr.serializer import BaseSerializer
class BaseController[T: BaseSerializer](Controller[T]):
pass
class PydanticController(BaseController[PydanticSerializer]):
pass
# This raises UnsolvableAnnotationsError
class UserController(PydanticController):
def get(self) -> ...:
...
Error
dmr.exceptions.UnsolvableAnnotationsError: Type args () are not correct for <class 'UserController'>,
at least 1 type arg must be provided
Expected behavior
UserController should inherit the serializer from its concrete parent PydanticController,
which already has serializer = PydanticSerializer set.
--
Thanks for the awesome library, I just started exploring it and I'm really enjoying it so far!
--
### How it should be?
Subclassing a concrete `Controller` subclass (one that already has a resolved serializer)
should work without requiring the type argument to be re-specified.
`UserController(PydanticController)` should behave the same as `UserController(BaseController[PydanticSerializer])`.
### Used versions
- `django-modern-rest==0.5.0`
- `Python 3.14.0`
### OS information
- `Linux tuxedo-stellaris 6.17.0-111019-tuxedo x86_64 (Ubuntu 24.04)`
#bug #good_first_issue #help_wanted #django_modern_rest
sent via relator