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
Hello!, I have simple model with a nullable field:
from tortoise import fields, models
class Scan(models.Model):
id = fields.IntField(pk=True)
scan_data = fields.JSONField()
time_stamp = fields.DatetimeField(auto_now=True, null=True)
class Meta:
table = "scans"
router = TortoiseCRUDRouter(
schema=models.Scan_Pydantic,
db_model=models.Scan
}
If I send some data to the post route, I expect that the "time_stamp" field will not need to be present in the payload because it is declared as nullable.
but instead this fails with a 422 saying the "time_stamp" field is required.
I understand that adding the field with a null value work but I feel like declaring the field as nullable on model should make the field optional entirely in body of create requests.
I'd be happy to submit a pr for this change if there is support for it ! :)
The text was updated successfully, but these errors were encountered:
Hello!, I have simple model with a nullable field:
If I send some data to the post route, I expect that the "time_stamp" field will not need to be present in the payload because it is declared as nullable.
but instead this fails with a 422 saying the "time_stamp" field is required.
I understand that adding the field with a null value work but I feel like declaring the field as nullable on model should make the field optional entirely in body of create requests.
I'd be happy to submit a pr for this change if there is support for it ! :)
The text was updated successfully, but these errors were encountered: