Is it possible to represent exceptions via autoschema/other means? #8650
Unanswered
ianfitzpatrick
asked this question in
Question & Answer
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm working with a mobile developer on an app, developing my API in DRF for the app to consume. The mobile dev uses an API mapping library that consumes OpenAPI document and maps responses to objects in Swift.
This works great and saves a lot of communication when it comes to positive responses like 200, 204, etc. I can't however seem to figure out if it's possible to map exception responses, like 403 or and 404 errors.
Does anyone know if it's possible to add 403 or 404 responses to a schema? I'm primarily using ModelViewSet to generate my schemas, with a little help from AutoSchema to manually specify schema responses for custom actions outside of list, retrieve, create, destroy, etc.
Bonus would be is there is some way to globally specify a default error object that would show in the openapi document.
It seems like I might need to look at drf-spectacular to do this, but so far the built-in schema generation has been doing everything I need it to, so hoping I can avoid adding a library.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions