Should we consider recommending drf-spectacular? #8453
-
The built-in schema generation is OK to get started, but OpenAPI is a big beast, and it would need a lot more time than it's had, or is ever likely to have, in order to fill-in all the edge-cases. Meanwhile over at
With an
... and then goes on to provide the numerous customisation points that we're never going to match in core. I think we should (consider to) make To begin a note at the top of the schema (and Documenting your API) docs — saying Hey, head-over here! Then, the whole Doing so would allow a focus on the viable package in this space, and significantly reduce the maintenance overhead on DRF, in an area where it's never quite had the resource needed to make it sing. What do you think? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 18 replies
-
@carltongibson I took a quick look and have some concerns around the ability to extend DRF to add Security Schemes and Security Objects which I've addressed in PR #7516 (and you liked 2 years ago) so that I can use those extended schemes to add OAuth2 security schemes and objects in django-oauth-toolkit's downstream extensions of DRF's BaseAuthentication and BasePermission classes. I imagine drf-spectacular could also leverage these hooks. Here's an example of how I've had to (poorly) work around this gap. Given the long wait and this PR getting bumped from 3.12 to 3.13 to 3.14 I was losing hope that this would ever happen. I suppose I could kludge up DOT to have configurable DRF schemas that it extends. That would be pretty ugly but sadly it's sounding like that's DRF's direction. Say it ain't so! |
Beta Was this translation helpful? Give feedback.
-
First of all, thank you very much for your kind words. It has been a lot of work that started simply out of desperation for a usable solution. Now I'm just enjoying that fact that it's used quite successfully in the wild. You could say I already was a pro user before, but writing this tool made me learn details about Django and DRF that I neither knew existed nor that I really ever wanted to know honestly. @carltongibson regarding a recommendation. Very much appreciated and I also think it is a good time. drf-spectacular has been very stable and I consider it mature at this point in time. We solved hundreds of issues and most new legitimate bugs are super esoteric edge cases that rarely anyone ever hits. The steady decline in bug reporting in conjuction with the amount of users tells me that we reached a nice plateau of stability. That also means the API is not expected to change in any significant way anymore (and has not for quite some time now). regarding deprecating parts of the DRF code: It is not a issue for us. Do as you see fit. We have very little hard dependencies left. As you said, we depend on the mechanics that were provided to us. I also want to stress that those mechanics have way more hidden complexity behind them than people realize. It's a good and stable API and as long as that is not gonna change in a significant way, we are good! Code wise, we probably have zero lines dependencies in Side-mark: what about core-api and "The Browsable API"? Is this still adding value to anyone? It was nice to have when nothing else was available, but nowadays using OpenAPI/SwaggerUI/drf-spectacular makes those old approaches seem quite antiquated with very little added benefit. Personally, I do love SwaggerUI! It's a fantastic well-maintained tool with a strong community. DRF is never gonna match this, so why keep reinventing a subpar wheel. I absolutely agree with you @carltongibson that it's better for DRF to focus on the core and stand on the shoulders of giants when it comes to those auxiliary topics. Regarding the discussion where the schema code should live. Well, it's the old framework or library question. Here are some thought on the nitty gritty:
@n2ygk regarding Django OAuth Toolkit (don't know what DJA stands for): We do ship with that support out-of-the-box and we do make use of what we can with Essentially, we did the same thing as you, but made it so that it's more pluggable and easier to work with. Please let me know if there is some gap for you there. I realized some time ago that this whole thing works so ridiculously automagically that people sometimes stumble over that simplicity on first contact. This also is a good example for the above TOOLING and KNOWLEDGE points. Afaik this extension works quite well for us. Let me know if there is anything missing for you. Sry for the effort you put into that PR, but maybe we can cherry-pick some aspects if we missed something on our side. Please let me know what you think @carltongibson @n2ygk! It's a big interconnected set of issue and writing down all my learnings from the past 2 years is quite hard, but I'll happily expand where needed. |
Beta Was this translation helpful? Give feedback.
First of all, thank you very much for your kind words. It has been a lot of work that started simply out of desperation for a usable solution. Now I'm just enjoying that fact that it's used quite successfully in the wild. You could say I already was a pro user before, but writing this tool made me learn details about Django and DRF that I neither knew existed nor that I really ever wanted to know honestly.
@carltongibson regarding a recommendation. Very much appreciated and I also think it is a good time. drf-spectacular has been very stable and I consider it mature at this point in time. We solved hundreds of issues and most new legitimate bugs are super esoteric edge cases that rarely a…