hapi-swagger
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -475,2 +475,11 @@ 'use strict'; | ||
method: 'GET', | ||
path: '/custom', | ||
config: { | ||
handler: function (request, reply) { | ||
reply.view('custom.html', {}); | ||
} | ||
} | ||
}, { | ||
method: 'GET', | ||
path: '/{path*}', | ||
@@ -477,0 +486,0 @@ handler: { |
@@ -135,1 +135,9 @@ 'use strict'; | ||
// add templates only for testing custom.html | ||
server.views({ | ||
path: 'bin', | ||
engines: { html: require('handlebars') }, | ||
isCached: false | ||
}); |
{ | ||
"name": "hapi-swagger", | ||
"description": "A swagger documentation UI generator plugin for hapi", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"author": "Glenn Jones", | ||
@@ -6,0 +6,0 @@ "repository": { |
177
README.md
@@ -155,2 +155,3 @@ # hapi-swagger | ||
* `order`: (int) The order in which endpoints are displayed, works with `options.sortEndpoints = 'ordered'` | ||
* `deprecated`: (boolean) Weather a endpoint has been deprecated - default: `false` | ||
@@ -403,82 +404,117 @@ ## Grouping endpoints with tags | ||
<link rel="icon" type="image/png" href="{{hapiSwagger.swaggerUIPath}}images/favicon-32x32.png" sizes="32x32" /> | ||
<link rel="icon" type="image/png" href="{{hapiSwagger.swaggerUIPath}}images/favicon-16x16.png" sizes="16x16" /> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/typography.css' media='screen' rel='stylesheet' type='text/css'/> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/reset.css' media='screen' rel='stylesheet' type='text/css'/> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/screen.css' media='screen' rel='stylesheet' type='text/css'/> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/reset.css' media='print' rel='stylesheet' type='text/css'/> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/print.css' media='print' rel='stylesheet' type='text/css'/> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery-1.8.0.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery.slideto.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery.wiggle.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery.ba-bbq.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/handlebars-2.0.0.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/underscore-min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/backbone-min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}swagger-ui.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/highlight.7.3.pack.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/marked.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/swagger-oauth.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}extend.js' type='text/javascript'></script> | ||
<link rel="icon" type="image/png" href="{{hapiSwagger.swaggerUIPath}}images/favicon-16x16.png" sizes="16x16" /> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/typography.css' media='screen' rel='stylesheet' type='text/css' /> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/reset.css' media='screen' rel='stylesheet' type='text/css' /> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/screen.css' media='screen' rel='stylesheet' type='text/css' /> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/reset.css' media='print' rel='stylesheet' type='text/css' /> | ||
<link href='{{hapiSwagger.swaggerUIPath}}css/print.css' media='print' rel='stylesheet' type='text/css' /> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery-1.8.0.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery.slideto.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery.wiggle.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery.ba-bbq.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/handlebars-2.0.0.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/js-yaml.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/lodash.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/backbone-min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}swagger-ui.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/highlight.7.3.pack.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/jsoneditor.min.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/marked.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}lib/swagger-oauth.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}extend.js' type='text/javascript'></script> | ||
<!-- Some basic translations --> | ||
<script src='{{hapiSwagger.swaggerUIPath}}/lang/translator.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}/lang/{{hapiSwagger.lang}}.js' type='text/javascript'></script> | ||
<!-- Some basic translations --> | ||
<script src='{{hapiSwagger.swaggerUIPath}}/lang/translator.js' type='text/javascript'></script> | ||
<script src='{{hapiSwagger.swaggerUIPath}}/lang/{{hapiSwagger.lang}}.js' type='text/javascript'></script> | ||
<script type="text/javascript"> | ||
<script type="text/javascript"> | ||
// creates a list of tags in the order they where created | ||
var tags = [] | ||
{{#each hapiSwagger.tags}} | ||
tags.push('{{name}}'); | ||
{{/each}} | ||
$(function () { | ||
var url = window.location.search.match(/url=([^&]+)/); | ||
if (url && url.length > 1) { | ||
url = decodeURIComponent(url[1]); | ||
} else { | ||
url = "{{{hapiSwagger.jsonPath}}}"; | ||
} | ||
// Pre load translate... | ||
if(window.SwaggerTranslator) { | ||
window.SwaggerTranslator.translate(); | ||
} | ||
$('#input_apiKey').hide(); | ||
// pull validatorUrl string or null form server | ||
var validatorUrl = null; | ||
{{#if hapiSwagger.validatorUrl}} | ||
validatorUrl: '{{hapiSwagger.validatorUrl}}'; | ||
{{/if}} | ||
var url = window.location.search.match(/url=([^&]+)/); | ||
if (url && url.length > 1) { | ||
url = decodeURIComponent(url[1]); | ||
} else { | ||
url = "{{{hapiSwagger.jsonPath}}}"; | ||
} | ||
window.swaggerUi = new SwaggerUi({ | ||
url: url, | ||
dom_id: "swagger-ui-container", | ||
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], | ||
onComplete: function(swaggerApi, swaggerUi){ | ||
if(window.SwaggerTranslator) { | ||
// Pre load translate... | ||
if(window.SwaggerTranslator) { | ||
window.SwaggerTranslator.translate(); | ||
} | ||
$('pre code').each(function(i, e) { | ||
hljs.highlightBlock(e) | ||
}); | ||
}, | ||
onFailure: function(data) { | ||
log("Unable to Load SwaggerUI"); | ||
}, | ||
docExpansion: "{{hapiSwagger.expanded}}", | ||
apisSorter: apisSorter.{{hapiSwagger.sortTags}}, | ||
operationsSorter: operationsSorter.{{hapiSwagger.sortEndpoints}}, | ||
showRequestHeaders: false, | ||
validatorUrl: validatorUrl | ||
}); | ||
} | ||
window.swaggerUi.load(); | ||
// pull validatorUrl string or null form server | ||
var validatorUrl = null; | ||
{{#if hapiSwagger.validatorUrl}} | ||
validatorUrl: '{{hapiSwagger.validatorUrl}}'; | ||
{{/if}} | ||
function log() { | ||
if ('console' in window) { | ||
console.log.apply(console, arguments); | ||
window.swaggerUi = new SwaggerUi({ | ||
url: url, | ||
dom_id: "swagger-ui-container", | ||
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], | ||
onComplete: function (swaggerApi, swaggerUi) { | ||
if (typeof initOAuth == "function") { | ||
initOAuth({ | ||
clientId: "your-client-id", | ||
clientSecret: "your-client-secret", | ||
realm: "your-realms", | ||
appName: "your-app-name", | ||
scopeSeparator: "," | ||
}); | ||
} | ||
if (window.SwaggerTranslator) { | ||
window.SwaggerTranslator.translate(); | ||
} | ||
$('pre code').each(function (i, e) { | ||
hljs.highlightBlock(e) | ||
}); | ||
if (Array.isArray(swaggerApi.auths) && swaggerApi.auths.length > 0 && swaggerApi.auths[0].type === "apiKey") { | ||
auth = swaggerApi.auths[0].value; | ||
$('#input_apiKey').show(); | ||
} | ||
//addApiKeyAuthorization(); | ||
}, | ||
onFailure: function (data) { | ||
log("Unable to Load SwaggerUI"); | ||
}, | ||
docExpansion: "{{hapiSwagger.expanded}}", | ||
apisSorter: apisSorter.{{hapiSwagger.sortTags}}, | ||
operationsSorter: operationsSorter.{{hapiSwagger.sortEndpoints}}, | ||
showRequestHeaders: false, | ||
validatorUrl: '{{hapiSwagger.validatorUrl}}', | ||
jsonEditor: {{#if isTrue}}true{{else}}false{{/if}} | ||
}); | ||
function addApiKeyAuthorization() { | ||
var key = $('#input_apiKey')[0].value; | ||
if (key && key.trim() != "") { | ||
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization(auth.name, key, auth.in); | ||
window.swaggerUi.api.clientAuthorizations.add(auth.name, apiKeyAuth); | ||
log("added key " + key); | ||
} | ||
} | ||
} | ||
$('#input_apiKey').change(addApiKeyAuthorization); | ||
window.swaggerUi.load(); | ||
function log() { | ||
if ('console' in window) { | ||
console.log.apply(console, arguments); | ||
} | ||
} | ||
}); | ||
// creates a list of tags in the order they where created | ||
var tags = [] | ||
{{#each hapiSwagger.tags}} | ||
tags.push('{{name}}'); | ||
{{/each}} | ||
</script> | ||
``` | ||
@@ -491,5 +527,4 @@ | ||
```html | ||
<section id="swagger"> | ||
<section class="swagger-section"> | ||
<h1 class="entry-title api-title">API</h1> | ||
<div id="message-bar" class="swagger-ui-wrap"></div> | ||
<div id="swagger-ui-container" class="swagger-ui-wrap"></div> | ||
@@ -496,0 +531,0 @@ </section> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3680730
93
42282
580