Skip to content

Instantly share code, notes, and snippets.

@vdel26
Last active August 29, 2015 14:25
Show Gist options
  • Save vdel26/e60e16e2b2e6c1e27bff to your computer and use it in GitHub Desktop.
Save vdel26/e60e16e2b2e6c1e27bff to your computer and use it in GitHub Desktop.
Using an external Swagger spec in Active Docs 2.0
<h1>Documentation</h1>
<p>Use our live documentation to learn about Hello World API</p>
<!--
Even if you are pulling from an external spec you need to specify a service here.
You can just create an empty spec and replace SPEC_NAME by the system_name of that
spec in 3scale.
-->
{% active_docs version: "2.0" service: "SPEC_NAME" %}
<script type="text/javascript">
$(function () {
// you have access to swaggerUi.options object to customize its behaviour
// the complete list of options is here: https://github.com/swagger-api/swagger-ui#parameters
// example: setting a different docExpansion mode
window.swaggerUi.options['docExpansion'] = 'none';
// example: getting the swagger specification loaded from a different url
window.swaggerUi.options['url'] = "http://petstore.swagger.io/v2/swagger.json";
window.swaggerUi.load();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment