Open Eraldo opened 5 months ago
blank
actually doesn't define a field as "nullable", what does is null
But having said that, we do have an issue with FileField
/ImageField
that we need to fix. More specifically, if the field is not set it will still return the field descriptor instead of None
.
I'll use this issue as a marker for that
Describe the Bug
Current:
FileField
withblank=True
gets resolved as required byauto
! Expected:FileField
withblank=True
gets resolved as optional byauto
.As a temporary workaround I overwrite them explicitly on my type if they are supposed to allow being optional:
asset: FileType | None
Error is thrown from here https://github.com/django/django/blob/475cffd1d64c690cdad16ede4d5e81985738ceb4/django/db/models/fields/files.py#L40
System Information
Additional Context
The issue has previously been reported, however the ticket owner closed it for a reason unknown to me. Ref: https://github.com/strawberry-graphql/strawberry-django/issues/58
Upvote & Fund