Open ngnpope opened 3 years ago
I see. uri-reference
is a bit more esoteric than uri
, but swagger-ui does not validate either of them when used with parameters. So the change should have no regressions ui-wise. However does this really happen in practice, since the request should be present when used natively with the API (unless used manually without context)?
Describe the bug
Django's
FileField
stores a relative URL, seeFieldFile.url
. DRF'sFileField
can attempt to make this absolute, see here, but this will not work when generating a schema as we have norequest
in the context.Currently
drf-spectacular
is using theuri
format:https://github.com/tfranzel/drf-spectacular/blob/59f9749086d5bf5d359ef7f8496bd39c88267721/drf_spectacular/openapi.py#L695-L696
When attempting to validate, the
uri
format, according to RFC 3986, is expected to be absolute.Expected behavior
The generated schema for
FileField
withuse_url=True
should beuri-reference
.