How to have both Swagger and ReDoc #889
Unanswered
barseghyanartur
asked this question in
Q&A
Replies: 1 comment
-
from ninja.openapi.docs import DocsBase, Swagger, Redoc
class MixedDocs(DocsBase):
def __init__(self) -> None:
super().__init__()
self.swagger = Swagger()
self.redoc = Redoc()
def render_page(self, request, api, **kwargs):
engine_name = kwargs.pop("engine")
engine = {
"swagger": self.swagger,
"redoc": self.redoc,
}.get(engine_name)
return engine.render_page(request, api, **kwargs)
api = NinjaAPI(docs_url='/docs/<engine>', docs=MixedDocs()) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to have both Swagger and ReDoc. How to do that?
Beta Was this translation helpful? Give feedback.
All reactions