Discussion:
Enums and Response Messages in django-rest-swagger
a***@thepattern.com
2018-05-23 16:51:03 UTC
Permalink
Hi folks,

Our team recently discovered the django-rest-swagger library, and we're
getting a lot of mileage out of documenting our APIs in-code in this way.
But we're blocked on two items that we'd love to get formatted correctly.

* We don't seem to be able to list separate response messages properly -
we've been attempting to document them like so:
responseMessages:
- code: "200"
message: "Json containing profile data"
- code: "400"
message: "Profile is not found. Please attempt to sign up."

But this approach all gets dumped into the "Description" as plain text,
while the "Response Messages" section further down has a single
undocumented 201. I haven't been able to find good examples of this working
- lots of examples of parameters, nothing on response messages. Am I
missing a trick, or is this maybe not supported by django-rest-swagger?

* We'd like to be able to list "enums" for string parameters. For instance,
a Gender field might allow M or F. I know this is supported by OpenAPI,
when we add the "enum" to the following, nothing happens:
- name: relationship
type: string
location: query
desc: Type of relationship between the two people in the
comparison
enum:
- "Friend"
- "Serious"

Generally, we're kind of stabbing in the dark with the formatting here - is
there any place where we can see more complex examples of API documentation
generated through django-rest-swagger? Am I maybe on the wrong track here,
and should instead look at making more sophisticated Django models, types,
and serializers, which will then auto-doc more easily? Happy for any clues
or pointers, thank you.

-Apollo
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...