Skip to content

Commit fa5d6cc

Browse files
docs: initialize redoc via JS API
Preparation for the next commit in which we'll make the script tag async (in order to use await to fetch the new versions.json file). Signed-off-by: Martin Fischer <[email protected]>
1 parent 8581502 commit fa5d6cc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docs/source/_static/api.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
</style>
1919
</head>
2020
<body>
21+
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
22+
<div id="redoc-container"></div>
2123
<script>
2224
// get version from query (default to latest)
2325
var queryString = window.location.search;
@@ -27,13 +29,10 @@
2729
version = query.get("version");
2830
}
2931

30-
var redoc = document.createElement("redoc");
31-
redoc.setAttribute("sort-props-alphabetically","");
32-
redoc.setAttribute("sort-operations-alphabetically","");
33-
redoc.setAttribute("spec-url","https://storage.googleapis.com/libpod-master-releases/swagger-" + version + ".yaml");
34-
35-
document.body.appendChild(redoc);
32+
Redoc.init("https://storage.googleapis.com/libpod-master-releases/swagger-" + version + ".yaml", {
33+
sortPropsAlphabetically: true,
34+
sortOperationsAlphabetically: true,
35+
}, document.getElementById("redoc-container"));
3636
</script>
37-
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
3837
</body>
3938
</html>

0 commit comments

Comments
 (0)