-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for Non-Model Views/Viewsets #4685
Comments
We do need to do a better job of documenting the limitations of the automatic schema generation, and describing how to do things explicitly in the cases that it can't automatically handle, yup. |
Fair enough, for now I will write schemas explicitly then. |
That's perfectly sensible, yup. Either:
|
Yeah, internal CoreAPI representations are my best choice now, as I see, I think this kind of docs should be generated (as it is in a well defined standard, by serializers, fields, routers...) or something like docstrings definitions (YAML, JSON...) but really close to the endpoint code and then schema would be generated from there. django-rest-swagger used to do this kind of thing taking advantage of YAML docstrings, but it is deprecated since version 2.0. |
This should be handled with the changes coming in with v3.7. Override The new system allows doing this per-view, so you don't loose auto-generation elsewhere. I'm going to close this for now. Happy to new issues on specifics once you've played with the new system! |
@carltongibson What about |
Viewsets are APIView subclasses. (It already works.) |
I'm struggling with a similar scenario of this issue #3373. I have a very specific service layer that gives a pretty well formed return and my views/viewsets have one job, call this service and serialize its result.
The thing is, I have two serializers, one to validate query parameters and another one to serialize service's raw return. None of them are used as "required" by DRF as
serializer_class
resulting that their fields won't be considered by SchemeGeneratorI'm failing when trying to create custom documentation to each endpoint, since DRF is kind of model-oriented to generate its schemas (I could write down my own schema, but I would love if DRF generates it for me though), plus I'm using Swagger as interface.
In my opinion, it would be nice to permit create docstring to create coreapi.Documents by that it would be way more flexible. Any ideas how I could proceed for now?
The text was updated successfully, but these errors were encountered: