swagger-ui-plugin-disable-try-it-out-without-servers
By default, if you don't provide any remote server information in your OpenAPI definiton, Swagger UI will direct requests to the host the definition was loaded from:
If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#openapi-object
This plugin changes Swagger UI's behavior so that an empty or missing global servers
field in an OpenAPI 3.0 document disables Try-It-Out completely.
If Swagger UI has a non-OpenAPI 3 definition loaded, this plugin will not affect Try-It-Out visibility or functionality.
Usage
Require
const DisableTryItOutWithoutServersPlugin = ;
<script>
<!-- Load Swagger UI --><!-- Load the DisableTryItOutWithoutServersPlugin -->
TODO
- Handle non-global
servers
data - Implement similar logic for Swagger 2.0 definitions