Comments (3)
Hahahaha, I'm very sorry, I gave the untested reference code. I am very happy to be able to help you!
from redoc-try.
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/[email protected]/bundles/redoc.standalone.min.js"> </script>
+ <script src="//cdn.jsdelivr.net/gh/wll8/[email protected]/dist/try.js"></script>
+ <script>
+ initTry({openapi_url})
+ </script>
</body>
</html>
"""
from redoc-try.
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! 👌
from redoc-try.
Related Issues (20)
- Something went wrong. HOT 1
- Examples not working HOT 6
- Error in the JS HOT 1
- How to use HOT 2
- FailureURL scheme must be "http" or "https" for CORS request HOT 1
- redoc-try causes wrong menu item highlighting when using anchor HOT 4
- use modal HOT 1
- reading json from static file
- problem in design HOT 2
- Support openAPI relative path HOT 10
- Try it option only works with spec url, it doesn't work when openApi spec is given as json object HOT 2
- overlapping other endpoints header HOT 7
- How to use redoc-try as react component? HOT 2
- Operation bloc not reset HOT 15
- Overlapping the try it window with the response details in Mobile view HOT 24
- OpenAPI 3.1 support HOT 2
- Authorization doesn't have the expand icon to show auth details HOT 1
- Height type error
- Not compatible with Redoc v 2.0-rc.33 or above HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redoc-try.