hapi-swagger
Advanced tools
Comparing version 0.7.2 to 0.7.3
@@ -1,2 +0,1 @@ | ||
var Hoek = require('hoek'), | ||
@@ -41,11 +40,4 @@ Boom = require('boom'), | ||
if(options.basePath){ | ||
console.log(['hapi-swagger', 'configuration'], 'basePath is now deprecated'); | ||
} | ||
var settings = Hoek.applyToDefaults(internals.defaults, options || {}); | ||
// get the prefix | ||
settings.prefix = server.realm.modifiers.route.prefix || ''; | ||
// append settings data in template context | ||
@@ -89,2 +81,11 @@ internals.appendReplyContext( server, settings ); | ||
method: 'GET', | ||
path: '/docs/swaggerui/images/throbber.gif', | ||
handler: function (request, reply) { | ||
reply.file( __dirname + '/../public/swaggerui/images/throbber.gif'); | ||
} | ||
}) | ||
server.route({ | ||
method: 'GET', | ||
path: settings.endpoint + '/custom.js', | ||
@@ -142,5 +143,11 @@ config: { | ||
requestSettings.basePath = request.server.info.uri; | ||
requestSettings.endpoint = requestSettings.basePath + requestSettings.prefix + requestSettings.endpoint; | ||
requestSettings.documentationPath = requestSettings.basePath + requestSettings.prefix + requestSettings.documentationPath; | ||
// prepend full protocol, hostname and port onto endpoints for shred | ||
var protocol = requestSettings.protocol || request.server.info.protocol || 'http'; | ||
var hostname = protocol + '://' + request.headers.host; | ||
if (!requestSettings.basePath.match(/^https?:\/\//)) { | ||
requestSettings.basePath = hostname + settings.basePath; | ||
} | ||
if (!requestSettings.endpoint.match(/^https?:\/\//)) { | ||
requestSettings.endpoint = requestSettings.basePath + settings.endpoint; | ||
} | ||
@@ -812,9 +819,3 @@ var routes = request.server.table()[0].table, | ||
} | ||
// repath with routes.prefix for template references | ||
var clientSettings = Hoek.clone(settings); | ||
clientSettings.endpoint = clientSettings.prefix + clientSettings.endpoint; | ||
clientSettings.documentationPath = clientSettings.prefix + clientSettings.documentationPath; | ||
response.source.context['hapiSwagger'] = clientSettings | ||
response.source.context['hapiSwagger'] = settings | ||
} | ||
@@ -827,2 +828,2 @@ | ||
exports._internals = internals; | ||
exports._internals = internals; |
{ | ||
"name": "hapi-swagger", | ||
"description": "A swagger documentation UI generator plugin for hapi", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"author": "Glenn Jones", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -153,3 +153,5 @@ # hapi-swagger | ||
* `apiVersion`: string The version of your API | ||
* `basePath`: string The base URL of the API i.e. `http://localhost:3000` | ||
* `documentationPath`: string The path of the documentation page - default: `/documentation`, | ||
* `enableDocumentationPage`: boolean Enable the the documentation page - default: `true`, | ||
* `endpoint`: string the JSON endpoint that descibes the API - default: `/docs` | ||
@@ -156,0 +158,0 @@ * `pathPrefixSize`: number Selects what segment of the URL path is used to group endpoints - default: `1` |
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
546076
10674
325
1