github.com/PDOK/gokoala@v0.50.6/internal/ogc/common/core/templates/api.go.html (about) 1 {{- /*gotype: github.com/PDOK/gokoala/internal/engine.TemplateData*/ -}} 2 {{define "content"}} 3 <hgroup> 4 <h1 class="title" id="title">{{ .Config.Title }} - OpenAPI {{ i18n "Specification" }}</h1> 5 </hgroup> 6 <div class="row py-3"> 7 <div class="col-md-12"> 8 {{ markdown .Config.Abstract }} 9 <table class="table table-borderless table-sm w-50"> 10 <tbody> 11 <tr> 12 <td class="w-25 fw-bold"> 13 {{ i18n "License" }} 14 </td> 15 <td> 16 <a href="{{ .Config.License.URL }}" target="_blank" aria-label="{{ cat (i18n "To") (i18n "License") .Config.License.Name }}">{{ .Config.License.Name }}</a> 17 </td> 18 </tr> 19 {{ if .Config.Support}} 20 <tr> 21 <td class="fw-bold"> 22 {{ i18n "Support" }} 23 </td> 24 <td> 25 <a href="{{ .Config.Support.URL }}" target="_blank" aria-label="{{ cat (i18n "To") (i18n "Support") }}">{{ .Config.Support.Name }}</a> 26 </td> 27 </tr> 28 {{ end }} 29 </tbody> 30 </table> 31 32 <!-- Anchor node for Swagger --> 33 <div id="swagger-ui"> 34 Loading... 35 </div> 36 37 <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/swagger-ui@4.5.0/dist/swagger-ui.min.css"> 38 <link rel="stylesheet" type="text/css" href="css/swagger-ui-pdok.css"> 39 40 <!-- Load Swagger --> 41 <script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@4.5.0/swagger-ui-bundle.js" charset="UTF-8"></script> 42 <script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@4.5.0/swagger-ui-standalone-preset.js" charset="UTF-8"></script> 43 <script> 44 // Redefine existing Swagger components. 45 // 46 // In this case we override the 'Info' component since we already provide these details in our HTML. 47 // 48 // Note: This is actually a React component but since we don't use any React features - it's an empty 49 // component after all - we don't include the React libs. When you do need to modify an existing 50 // component include the following libs: 51 // - https://cdn.jsdelivr.net/npm/react@18/umd/react.production.min.js 52 // - https://cdn.jsdelivr.net/npm/react-dom@18/umd/react-dom.production.min.js 53 // Do note that JSX is not supported since it requires Babel.js 54 class EmptyInfo { 55 render() { 56 return null 57 } 58 } 59 60 // Create plugin to wire the redefined components 61 const GoKoalaLayoutPlugin = () => { 62 return { 63 // See https://github.com/swagger-api/swagger-ui/blob/master/src/core/components/layouts/base.jsx 64 // for the components used in Swagger BaseLayout 65 components: { 66 InfoContainer: () => EmptyInfo 67 } 68 } 69 } 70 71 window.onload = function () { 72 // Begin Swagger UI call region 73 const ui = SwaggerUIBundle({ 74 url: "./api?f=json", 75 dom_id: '#swagger-ui', 76 deepLinking: false, 77 presets: [ 78 SwaggerUIBundle.presets.apis, 79 SwaggerUIStandalonePreset 80 ], 81 plugins: [ 82 GoKoalaLayoutPlugin, 83 SwaggerUIBundle.plugins.DownloadUrl 84 ], 85 layout: "BaseLayout" 86 }); 87 // End Swagger UI call region 88 89 window.ui = ui 90 } 91 </script> 92 </div> 93 </div> 94 {{end}}