2023-11-17 00:05:35 +00:00
|
|
|
<script lang="ts">
|
2023-11-19 19:27:22 +00:00
|
|
|
import { Button, Container } from 'sveltestrap';
|
2023-11-17 00:05:35 +00:00
|
|
|
|
|
|
|
import { onMount } from 'svelte';
|
2023-11-19 19:27:22 +00:00
|
|
|
let swaggerLoaded: boolean = false;
|
2023-11-17 20:02:31 +00:00
|
|
|
|
2023-11-17 00:05:35 +00:00
|
|
|
onMount(async () => {
|
2023-11-17 20:02:31 +00:00
|
|
|
loadSwagger();
|
2023-11-17 00:05:35 +00:00
|
|
|
});
|
2023-11-17 20:02:31 +00:00
|
|
|
|
|
|
|
const loadSwagger = () => {
|
2023-11-19 19:27:22 +00:00
|
|
|
// @ts-expect-error: SwaggerUIBundle is loaded from external script from CDN
|
|
|
|
if (!SwaggerUIBundle) return; // eslint-disable-line
|
2023-11-17 20:02:31 +00:00
|
|
|
swaggerLoaded = true;
|
2023-11-19 19:27:22 +00:00
|
|
|
// @ts-expect-error: SwaggerUIBundle is loaded from external script from CDN
|
|
|
|
// eslint-disable-next-line
|
2023-11-17 20:02:31 +00:00
|
|
|
window.ui = SwaggerUIBundle({
|
2023-11-19 19:27:22 +00:00
|
|
|
url: '/swagger.json',
|
|
|
|
dom_id: '#swagger-ui-container',
|
|
|
|
presets: [
|
|
|
|
// @ts-expect-error: SwaggerUIBundle is loaded from external script from CDN
|
|
|
|
SwaggerUIBundle.presets.apis, // eslint-disable-line
|
|
|
|
// @ts-expect-error: SwaggerUIStandalonePreset is loaded from external script from CDN
|
|
|
|
SwaggerUIStandalonePreset // eslint-disable-line
|
|
|
|
]
|
|
|
|
// layout: "StandaloneLayout",
|
|
|
|
});
|
|
|
|
};
|
2023-11-17 00:05:35 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<svelte:head>
|
2023-11-17 18:10:46 +00:00
|
|
|
<title>API playground</title>
|
|
|
|
<script
|
|
|
|
src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.10.0/swagger-ui-bundle.min.js"
|
|
|
|
integrity="sha512-Ckle4LZv9LhAfEdohBdUi+QCu0e7HkXHTeSPXfbDzbCsR87QNTUBylkBEPsBNn4Ph83yK1hJ6f2uH4QMtB0hTA=="
|
|
|
|
crossorigin="anonymous"
|
|
|
|
referrerpolicy="no-referrer"
|
|
|
|
></script>
|
|
|
|
<script
|
|
|
|
src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.10.0/swagger-ui-standalone-preset.min.js"
|
|
|
|
integrity="sha512-qwGi7EG31HcylzamsmacHLZJrfUGRuuHEaCMcOojuNpMu+paR554VjaCZ9LdUVTrmF8xC03YVqTzuKx0SDdruA=="
|
|
|
|
crossorigin="anonymous"
|
|
|
|
referrerpolicy="no-referrer"
|
|
|
|
></script>
|
|
|
|
<link
|
|
|
|
rel="stylesheet"
|
|
|
|
href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.10.0/swagger-ui.min.css"
|
|
|
|
integrity="sha512-Ck+X9SARG7WscOTG4a8Qod5Zgd1MZlz4VtyyucjMJ3PnZy2lUl7q/v/0055yIfGM/v+f+216ME0/dv0qqtm6+g=="
|
|
|
|
crossorigin="anonymous"
|
|
|
|
referrerpolicy="no-referrer"
|
|
|
|
/>
|
2023-11-17 00:05:35 +00:00
|
|
|
</svelte:head>
|
|
|
|
|
2023-11-17 20:02:31 +00:00
|
|
|
<Container fluid class="bg-light">
|
2023-11-19 19:27:22 +00:00
|
|
|
<section class:invisible={swaggerLoaded}><Button on:click={loadSwagger}>Load</Button></section>
|
2023-11-17 18:10:46 +00:00
|
|
|
<div id="swagger-ui-container" />
|
2023-11-17 00:05:35 +00:00
|
|
|
</Container>
|