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
When I use Field(list, alias="model related name") API doc generation no longer works and fails out with an issue with serializing. I'm not sure if this is how I am doing it or if I should make it Optional[List[BookSchema]] in the case that no matching foreign keys exist.
classAuthor(models.Model):
first_name=models.CharField(max_length=64)
last_name=models.CharField(max_length=64)
classBook(models.Model):
title=models.CharField(max_length=64)
author=models.ForeignKey(
Author,
related_name="books",
null=False,
on_delete=models.CASCADE,
)
classBookSchema(Schema):
title: strclassAuthorSchema(Schema):
first_name: strlast_name: strbooks: List[BookSchema] =Field(list, alias="books") # Causes an error in API docs
The text was updated successfully, but these errors were encountered:
When I use Field(list, alias="model related name") API doc generation no longer works and fails out with an issue with serializing. I'm not sure if this is how I am doing it or if I should make it
Optional[List[BookSchema]]
in the case that no matching foreign keys exist.The text was updated successfully, but these errors were encountered: