-
-
Notifications
You must be signed in to change notification settings - Fork 527
Open
Description
I have been creating a ninja API for my web app and have found the process very smooth, and have been enjoying the open API auto documentation, which I rely on in my front-end. I have encountered one problem in dealing with a file download endpoint.
The response should be easily specifiable under the openapi specs as
content:
application/octet-stream:
schema:
type: string
format: binary
however I've found no easy way to implement this within django-ninja.
I've had a look through the code and I think I've found where a change could be made
if model not in [None, NOT_SET]:
# ::TODO:: test this: by_alias == True
schema = self._create_schema_from_model(
model, by_alias=operation.by_alias
)[0]
details[status]["content"] = {
self.api.renderer.media_type: {"schema": schema}
}
if the schema
had an __ninja_override_media_type__
attribute, this could be used to provide a custom media type for a response.
If you want me to have a stab at writing a PR for this let me know
noamsto
Metadata
Metadata
Assignees
Labels
No labels