use super::builder::APIApp;
impl<S> APIApp<S>
where
S: Clone + Send + Sync + 'static,
{
pub fn swagger_html(openapi_path: &str) -> String {
format!(
r#"<!DOCTYPE html>
<html>
<head>
<title>Swagger UI</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" />
<style>
body {{ margin: 0; padding: 0; }}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js"></script>
<script>
window.onload = function() {{
SwaggerUIBundle({{
url: "{openapi_path}",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
layout: "BaseLayout",
deepLinking: true
}});
}};
</script>
</body>
</html>"#
)
}
}