This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"host": "petstore.swagger.wordnik.com", | |
"info": { | |
"title": "Test Spec", | |
"version": "1.0.0" | |
}, | |
"paths": { | |
"/road": { | |
"get": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"basePath": "http://localhost:3000/s/", | |
"host": "petstore.swagger.wordnik.com", | |
"info": { | |
"title": "swagger-ui#1234", | |
"title": "Describe your issue here", | |
"version": "1.0.0" | |
}, | |
"paths": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"host": "petstore.swagger.wordnik.com", | |
"info": { | |
"title": "swagger-ui#1234", | |
"title": "Describe your issue here", | |
"version": "1.0.0" | |
}, | |
"paths": { | |
"/road": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = require('swagger-client'); | |
var swagger = new client({ | |
url: 'http://petstore.swagger.io/v2/swagger.json', | |
success: function() { | |
swagger.apis.pet.getPetById({petId:10},function(pet){ | |
console.log('pet', pet); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src='browser/swagger-client.js' type='text/javascript'></script> | |
<script type="text/javascript"> | |
// initialize swagger, point to a resource listing | |
window.swagger = new SwaggerClient({ | |
url: "http://petstore.swagger.io/api/api-docs", | |
success: function() { | |
// This will add a query parameter called api_key with the value 'special-key' | |
this.clientAuthorizations.add("api_key", new client.ApiKeyAuthorization("api_key","special-key","query")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Swagger UI</title> | |
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" /> | |
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" /> | |
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/> | |
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/> | |
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> | |
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This can only get called from within the success handler, as we need swagger-client to be instantiated. | |
function addApiKeyAuthorization(){ | |
var key = encodeURIComponent($('#input_apiKey')[0].value); | |
if(key && key.trim() != "") { | |
var someAweseomAuth = new SwaggerClient.PasswordAuthorization("yourAuthName", "some user", "some password"); | |
window.swaggerUi.api.clientAuthorizations.add("yourAuthName", someAweseomAuth); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Swagger UI</title> | |
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" /> | |
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" /> | |
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/> | |
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/> | |
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> | |
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This goes in the dist/index.html file found in swagger-ui. | |
// Be careful that the file gets overwritten when you build swagger-ui | |
window.swaggerUi = new SwaggerUi({ | |
url: url, | |
spec: { | |
// ... | |
// your spec here | |
// .... | |
}, |
OlderNewer