Open
Description
Describe the Bug
Receiving the following error:
strawberry.exceptions.missing_return_annotation.MissingReturnAnnotationError
When trying to use inheritance with the Strawberry models and SQLAlchemy model relationships. I have a very contrived example below but while the error is a bit confusing i'm not sure what the desired behaviour should be.
Should the mapper be able to handle inheritance?
from sqlalchemy.orm import (
DeclarativeBase,
relationship,
Mapped,
mapped_column,
)
from sqlalchemy import ForeignKey
from strawberry_sqlalchemy_mapper import StrawberrySQLAlchemyMapper
strawberry_sqlalchemy_mapper = StrawberrySQLAlchemyMapper()
class Base(DeclarativeBase):
pass
class ModelA(Base):
__tablename__ = "a"
id: Mapped[str] = mapped_column(primary_key=True)
relationshipB_id: Mapped[str] = mapped_column(ForeignKey(f"b.id"))
relationshipB: Mapped["ModelB"] = relationship()
class ModelB(Base):
__tablename__ = "b"
id: Mapped[str] = mapped_column(primary_key=True)
relationshipB_id: Mapped[str] = mapped_column(ForeignKey(f"b.id"))
relationshipB: Mapped["ModelB"] = relationship()
@strawberry_sqlalchemy_mapper.type(ModelA)
class ApiA:
pass
@strawberry_sqlalchemy_mapper.type(ModelB)
class ApiB(ApiA):
pass
System Information
- Operating system: windows
- Strawberry version (if applicable): 0.268.1 / 0.6.1