Skip to content

Instantly share code, notes, and snippets.

@jellehak
Created March 27, 2021 11:20
Show Gist options
  • Save jellehak/6afd47367b3d09777b5f079b14a182b3 to your computer and use it in GitHub Desktop.
Save jellehak/6afd47367b3d09777b5f079b14a182b3 to your computer and use it in GitHub Desktop.
Swagger CDN
<!DOCTYPE html>
<html>
<head>
<title>Docs</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/swagger-ui.css">
</head>
<body>
<div id="ui-wrapper-new" data-spec="{{spec}}">
Loading....
</div>
</body>
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js"></script>
<script>
var swaggerUIOptions = {
url: "https://petstore.swagger.io/v2/swagger.json",
dom_id: '#ui-wrapper-new', // Determine what element to load swagger ui
docExpansion: 'list',
deepLinking: true, // Enables dynamic deep linking for tags and operations
filter: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
}
var ui = SwaggerUIBundle(swaggerUIOptions)
/** Export to window for use in custom js */
window.ui = ui
</script>
</html>
@mijorus
Copy link

mijorus commented Jan 12, 2023

Please use @latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment