Skip to content
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

Feature: support templating in redoc.html #978

Closed
dhruvkb opened this issue Apr 23, 2023 · 2 comments
Closed

Feature: support templating in redoc.html #978

dhruvkb opened this issue Apr 23, 2023 · 2 comments
Labels
enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending

Comments

@dhruvkb
Copy link

dhruvkb commented Apr 23, 2023

Describe the feature
The redoc.html file included in the project templates (https://github.com/tfranzel/drf-spectacular/blob/28b858e83e8341c806cc23e7cb09ea1f06b2b357/drf_spectacular/templates/drf_spectacular/redoc.html) is great as a Redoc site starting point, but a mature project needs to also include some custom code.

Expected behavior
Changing the HTML template to include some blocks would project a lot of benefits such as the ability to

  • include some custom CSS
    • possibly implement a dark theme
  • add a favicon to the site
  • add open-graph meta tags

Currently there is no known or documented way to achieve these goals.

@tfranzel
Copy link
Owner

We added a lot of customization for swagger-ui and it was never really enough. I would prefer to not add 3-4 more settings just for redoc.

We finally added blocks in #918, which is flexible and not that settings-heavy. I could image having the same for redoc.

In any case, you can always override a template (via app ordering) for any django app yourself. Nothing special going on here. The blocks version is just a less copy&pasty version of that.

@dhruvkb
Copy link
Author

dhruvkb commented Apr 29, 2023

Yes, my requests was precisely to support blocks in the Redoc template. Happy to make a PR that adds {% block %}s if you would accept.

As a user, we could overwrite the entire template, but that would mean losing out on any improvements brought by future updates to drf-spectacular unless we manually check and keep comparing the two versions.

tfranzel added a commit that referenced this issue Apr 30, 2023
@tfranzel tfranzel added enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending labels May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending
Projects
None yet
Development

No branches or pull requests

2 participants