OpenAPI

/views/vopenapi/OpenAPI.html (970 B)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{% import (
"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/views/layout"
) %}

{% code type OpenAPI struct {
layout.Basic
URL string
} %}

{% func (p *OpenAPI) Body(as *app.State, ps *cutil.PageState) %}
<div id="swagger-ui"></div>
<link rel="stylesheet" type="text/css" href="/assets/openapi/swagger-ui.css" />
<script src="/assets/openapi/swagger-ui-bundle.js" defer="defer"></script>
<script src="/assets/openapi/swagger-ui-standalone-preset.js" defer="defer"></script>
<script>
window.onload = function() {
window.ui = SwaggerUIBundle({
url: "{%s p.URL %}",
dom_id: '#swagger-ui',
deepLinking: true,
displayRequestDuration: true,
filter: true,
tryItOutEnabled: true,
presets: [
SwaggerUIBundle.presets.apis
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
]
});
};
</script>
{% endfunc %}