-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception caught for serializer field ReadOnlyField with a FileField source #1303
Comments
I would like some kind of workaround, but I am not sure how one would use |
Hi, you can do this We have a lot of navigation power in there, but even if we would have accessed There are a few ways to get there (e.g. typed property function on the model) with fsize = serializers.SerializerMethodField()
def get_fsize(self, object) -> int:
return object.fname.size |
@tfranzel Thank you for the solution! |
Describe the bug
I have a simple file server:
Generating the OpenAPI schema using drf-spectacular prints this warning:
To Reproduce
See https:/jennydaman/spectacular-fsize-bug
Expected behavior
No warnings.
components.schemas.FooFile.properties.fsize.type
should benumber
.The text was updated successfully, but these errors were encountered: