-
-
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
Function views are not included in the auto documentation #5343
Comments
@hnykda I need a bit more to go on here. 🙂 What's your URL conf etc? — is the function view nested? — What does, the relevant part of, the schema look like? Can you narrow this down to the smallest example? Thanks. |
Sorry. Should have be more specific. URL confsMain
includes these
Viewsand the function view itself is not nested:
|
But what's the relevant part of the schema? You said If it's nested under |
Ahh, you mean nested inside an app? Yes, they are under |
Well, it's good it shows.
OK. Can you help diagnose that? Is there an error in the JS console for instance? (@woile: could there be a lingering issue in the JS
This is just to do with how the
Well, you can subclass |
I'll check it out. If we had the js errors from the console it would be great. |
OK. I cannot reproduce an issue here. With a class-based view, nested and displayed using @hnykda — you're dealing with function-based views right. I'm guessing that the introspection doesn't give enough to build the request. i.e. Without a |
@carltongibson I tried reproducing with He is right in the naming convention though, I don't know if
|
@woile: Thanks for the follow-up! (It really helps.) The rigidity of the naming is known. (e.g. #5165 and others). #5337 should allow flexibility, without settings (shudder 🙂) or the need to parse docstrings. (The strategy will be to use @hnykda: Thanks for the report and your follow-up! I'm going to close this as ultimately I think it's a usage issue rather than anything particular. Yes, there are still teething issues with the schema generation but I think we need to review after the next phase. Please stay involved: feedback and input is really important. (If it's a usage question the Mailing List is the best place; if it's a bug then here.) Thanks again. |
Hey! Thank you for such a quick response! Sorry for a delay from my side. Yes, I am using function views. And yes - after trying in an Chrome anonymous window or Firefox, it works as expected - so it was probably cached somehow. Again, sorry. I really like @woile idea about settings, where we could just have a METHOD + URL definition instead REST. You mentioned that there are edge cases. I am curious - how else do you do a non-model related API endpoints, e.g. "run a service job which updates some assets somewhere" and so on? AFAIK, class based API views are to rigid for that, hence the function views. |
@hnykda Thanks for the follow-up.
In this case you extend |
Besides traditional
ListCreateAPIView
, I also have function based views using@api_view
decorator. Unfortunately, these are not picked up in the generated documentation. They are, however, present in the schema.Steps to reproduce
Write function view, open docs.
Expected behavior
Function views should be present in the generated documentation. DRF docs or Swagger for DRF can pick them as as expected.
Actual behavior
Views are not present.
Or am I missing something? Thanks
The text was updated successfully, but these errors were encountered: