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
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
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
The text was updated successfully, but these errors were encountered:
LevonW-IIS
changed the title
Add support for a built in file schema
Add support for different content type responses (e.g. application/octet-stream)
Feb 6, 2024
Thanks for the speedy reply. Didn't manage to spot this in the docs.
Some extension of response= would be nice. There's a fair few file types where "schema": {"type": "string", "format": "binary"} would remain the same but you might want to change up the content type, e.g. application/pdf, application/zip, application/vnd.*.
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
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 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
The text was updated successfully, but these errors were encountered: