-
Notifications
You must be signed in to change notification settings - Fork 260
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
Adds a bit about redoc logo in docs, adds a custom_path_ordering hook, adds ability for configuring hooks from config #410
Conversation
…ordering postprocess hook
Codecov Report
@@ Coverage Diff @@
## master #410 +/- ##
==========================================
- Coverage 98.51% 98.22% -0.29%
==========================================
Files 55 55
Lines 5394 5416 +22
==========================================
+ Hits 5314 5320 +6
- Misses 80 96 +16
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @allen-munsch, thanks for the PR. i think i need a bit more context. please correct me if i'm wrong but i believe we already have this functionality with PREPROCESSING_HOOKS
. see comments below.
furthermore it would break everyone using POSTPROCESSING_HOOKS
. we really need a very good reason to even consider breaking compatibility.
@@ -10,6 +10,38 @@ | |||
from drf_spectacular.settings import spectacular_settings | |||
|
|||
|
|||
def custom_path_ordering(result, generator, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see the need for custom endpoint order.
to me that looks like a perfect usage of PREPROCESSING_HOOKS
: https://drf-spectacular.readthedocs.io/en/latest/customization.html#step-7-preprocessing-hooks
there you can filter and reorder the endpoints to your liking. Not sure if this adds anything substantial to that existing functionality?
@tfranzel yeah i dunno preproccess hook didn't seems to keep the ordering also the core hooks are not configurable, sure can keep configs bundled with the hooks, but i dunno settings allover the place instead of all in the settings.py seems werid. and i didnt see offhand how restframework APISettings would allow that alongside the dot imports strings |
that is an excellent point. i noticed there is sorting applied after the
there should be nothing preventing you from loading the django/DRF settings inside the hook and then using them. then you have everything in your |
come to think of it. we have |
Adds a bit about redoc logo in docs, adds a custom_path_ordering hook, adds ability for configuring hooks from config