-
Notifications
You must be signed in to change notification settings - Fork 498
Description
I am incorporating a Swagger generated docs within a documenter, which looks promising:

However, I have stumbled on a blocking issue where the code above works only if the swagger is loaded before the require.min.js
is loaded, but the user assets provided to makedocs
in format argument are loaded only afterwards. The code that renders the page is as follows and is included with @raw html
:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.11.9/swagger-ui.css">
<style>
.swagger-ui .information-container {
display: none !important;
}
.swagger-ui #operations-tag-default {
display: none !important;
}
</style>
<div id="swagger-ui"></div>
<script>
window.onload = () => {
window.ui = SwaggerUIBundle({
url: window.location.origin + "/assets/swagger/schema.json",
dom_id: '#swagger-ui',
});
};
</script>
A simple solution I see is that user asset_links
in render_head
function could be loaded before requirejs_cdn
, which would only involve reordering.
Another more sophisticated approach is to make SwaggerUI to be integrated in the same way as higlighting and math rendering is. This involves understanding how requirejs
works, documenter internals which is more complex task for which I can’t allocate time.