{# This file is part of the API Platform project.
(c) Kévin Dunglas <dunglas@gmail.com>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code. #}
<!DOCTYPE html>
<html>
<head>
{% block meta %}
<meta charset="UTF-8">
{% endblock meta %}
<title>{% block title %}{{ swaggerData.info.title }}{% endblock title %}</title>
{% block stylesheets %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.23.11/swagger-ui.css">
{% endblock stylesheets %}
{% block swagger_data %}
{# json_encode(65) is for JSON_UNESCAPED_SLASHES|JSON_HEX_TAG to avoid JS XSS #}
<script id="swagger-data" type="application/json">{{ swaggerData|json_encode(65)|raw }}</script>
{% endblock swagger_data %}
</head>
<body>
{% block swagger_ui %}
<div id="swagger-ui"></div>
{% endblock %}
{% block javascripts %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.23.11/swagger-ui-bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.23.11/swagger-ui-standalone-preset.js"></script>
{% endblock javascripts %}
{% block swagger_initialization %}
<script>
window.onload = function() {
var data = JSON.parse(document.getElementById('swagger-data').innerText);
// Begin Swagger UI call region
window.ui = SwaggerUIBundle({
spec: data,
dom_id: '#swagger-ui',
validatorUrl: null,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset.slice(1) // here
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
var btnAuth = document.querySelector('.auth-wrapper .btn.authorize');
if (btnAuth) {
btnAuth.addEventListener('click', function() {
setTimeout(function() {
if (data.components && data.components.securitySchemes) {
var i = 0;
for (var name in data.components.securitySchemes) {
var security = data.components.securitySchemes[name];
if (security.defaultValue) {
var input = document.querySelector('.auth-wrapper .auth-container:nth-child('+(i+1)+') input');
if(input && !input.value) {
input.value = security.defaultValue;
var event = new Event('change', {bubbles: true});
event.simulated = true;
input.dispatchEvent(event);
}
}
i++;
}
}
}, 100);
});
}
}
</script>
{% endblock swagger_initialization %}
</body>
</html>