You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Having tried django-ninja framework I see some issues with type checkers like pyright. Not sure if thats even possible, But I'd appreciate if someone could take a look at it. Or maybe there is any better approach I could take to avoid silencing typecheckers all the time.
from ..models import Location
from ninja import ModelSchema
class LocationCreateSchema(ModelSchema):
class Meta:
model = Location
fields = ['name', 'description']
Obviously this example doesn't make sense logic-wise, but shows the problem.
The only workaround I could have think of is either to silence the warning, or write TypeGuard for each and every schema, which add like 10x more boilerplate than schema itself.
Pyright doesnt recognize LocationReadSchema attributes inherited from Location model. I get error:
error: Cannot access attribute "name" for class "LocationReadSchema"
Describe the solution you'd like
I'd love to see the solution that allows to use pyright for ninja projects that can recognize fields of schemas inherited from django models.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Having tried django-ninja framework I see some issues with type checkers like pyright. Not sure if thats even possible, But I'd appreciate if someone could take a look at it. Or maybe there is any better approach I could take to avoid silencing typecheckers all the time.
Given following django model:
and following schema:
Im having this endpoint implementation:
Obviously this example doesn't make sense logic-wise, but shows the problem.
The only workaround I could have think of is either to silence the warning, or write TypeGuard for each and every schema, which add like 10x more boilerplate than schema itself.
Pyright doesnt recognize LocationReadSchema attributes inherited from Location model. I get error:
error: Cannot access attribute "name" for class "LocationReadSchema"
Describe the solution you'd like
I'd love to see the solution that allows to use pyright for ninja projects that can recognize fields of schemas inherited from django models.
The text was updated successfully, but these errors were encountered: