Hi,
Here my openapi schema:
{
"openapi": "3.0.0",
"info": {
"title": "OpenApi Rest Documentation",
"version": "1.0"
},
"servers": [
{
"url": "http://"
}
],
"paths": {
"/trolls": {
"get": {
"summary": "Retrieve trolls or specific troll",
"description": "",
"tags": [],
"responses": {
"200": {
"description": "Success"
}
},
"operationId": "get_troll"
}
}
}
}
I added a html template file to serve swagger-ui in my project:
<!Doctype html>
<html>
<head>
<title>Swagger</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="//unpkg.com/swagger-ui-dist@3/swagger-ui.css" />
</head>
<body>
<h1>{{ url_for ('openapi') }}</h1>
<div id="swagger-ui"></div>
<script src="//unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
<script>
const ui = SwaggerUIBundle({
url: "{{ url_for ('openapi') }}",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
layout: "BaseLayout",
requestInterceptor: (request) => {
request.headers['X-CSRFToken'] = "{{ csrf_token }}"
return request;
}
})
</script>
</body>
</html>
Everything work as expected but "try it out" button doesn't work because it try to perform request against http://mydomain/openapi.json/trolls instead of http://mydomain/trolls as expected.
I tried to find in swagger-ui documentation how to specify the base_url. But i didn't find something to do that. I am not sure my issue related to quart-openapi or a misconfiguration on swagger-ui.html.
Is there something to specify the base_url to test for swagger-ui ? Is there an information I have to provice in openapi.json or in SwaggerUIBundle ?
Hi,
Here my openapi schema:
{ "openapi": "3.0.0", "info": { "title": "OpenApi Rest Documentation", "version": "1.0" }, "servers": [ { "url": "http://" } ], "paths": { "/trolls": { "get": { "summary": "Retrieve trolls or specific troll", "description": "", "tags": [], "responses": { "200": { "description": "Success" } }, "operationId": "get_troll" } } } }I added a html template file to serve swagger-ui in my project:
Everything work as expected but "try it out" button doesn't work because it try to perform request against
http://mydomain/openapi.json/trollsinstead ofhttp://mydomain/trollsas expected.I tried to find in swagger-ui documentation how to specify the base_url. But i didn't find something to do that. I am not sure my issue related to quart-openapi or a misconfiguration on swagger-ui.html.
Is there something to specify the base_url to test for swagger-ui ? Is there an information I have to provice in openapi.json or in SwaggerUIBundle ?