Closed Trinkes closed 3 years ago
You may need to slightly modify the source code of fastapi, similar to the following form:
html = f"""
<!DOCTYPE html>
<html>
<head>
<title>{title}</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
"""
if with_google_fonts:
html += """
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
"""
html += f"""
<link rel="shortcut icon" href="{redoc_favicon_url}">
<style>
body {{
margin: 0;
padding: 0;
}}
</style>
</head>
<body>
- <redoc spec-url="{openapi_url}"></redoc>
- <script src="{redoc_js_url}"> </script>
+ <div id="redoc-container"></div>
+ <script src="//cdn.jsdelivr.net/npm/redoc@2.0.0-rc.48/bundles/redoc.standalone.min.js"> </script>
+ <script src="//cdn.jsdelivr.net/gh/wll8/redoc-try@1.3.4/dist/try.js"></script>
+ <script>
+ initTry({openapi_url})
+ </script>
</body>
</html>
"""
For future references, to make it work, I had to change your code:
initTry({openapi_url})
to
initTry(\"{openapi_url}\")
Other than that, it worked like a charm, thank you very much! :ok_hand:
Hahahaha, I'm very sorry, I gave the untested reference code. I am very happy to be able to help you!
Hello, I'm currently using python's library FastAPI to make the endpoints and generate its Redoc documentation, is there any way to integrate your project using FastApi library?