Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hapi-swagger

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-swagger - npm Package Compare versions

Comparing version 0.0.6 to 0.1.1

48

lib/index.js

@@ -50,5 +50,5 @@ var Hoek = require('hoek'),

},
handler: function (request) {
handler: function (request, reply) {
var routes = request.server.routingTable(),
var routes = (request.server.routingTable)? request.server.routingTable(): request.server.table(),
resourceName = request.query.path;

@@ -72,3 +72,3 @@

if (!routes.length) {
return request.reply(Boom.notFound());
return reply(Boom.notFound());
}

@@ -79,3 +79,5 @@

routes.sort(function (route1, route2) {
return route1.path > route2.path;
if (route1.path < route2.path) return -1;
if (route1.path > route2.path) return 1;
return 0;
});

@@ -88,3 +90,3 @@

apiData.path = routes[0] ? routes[0].path : '/';
return request.reply(internals.buildAPIInfo( settings, apiData, request.query.path)).type('application/json; charset=utf-8');
return reply(internals.buildAPIInfo( settings, apiData, request.query.path)).type('application/json; charset=utf-8');
}

@@ -94,3 +96,3 @@

// build documentation API discovery endpoint
return request.reply(internals.buildAPIDiscovery( settings, routes )).type('application/json; charset=utf-8');
return reply(internals.buildAPIDiscovery( settings, routes )).type('application/json; charset=utf-8');

@@ -264,12 +266,26 @@ },

var param = params[key];
paramsData.push({
name: key,
description: typeof param.description === 'function' ? '' : param.description,
notes: typeof param.notes === 'function' ? '' : param.notes,
tags: typeof param.tags === 'function' ? '' : param.tags,
type: param.type,
required: param.__modifiers && param.__modifiers._values ? param.__modifiers._values.some(internals.isRequiredParam) : null,
allowedValues: param.__valids ? internals.getExistsValues(param.__valids._exists) : null,
disallowedValues: param.__invalids ? internals.getExistsValues(param.__invalids._exists) : null
});
if(param.describe){
// version 2.x of HAPI
var describe = param.describe();
paramsData.push({
name: key,
description: typeof param._description === 'function' ? '' : param._description,
notes: typeof param._notes === 'function' ? '' : param._notes,
tags: typeof param._tags === 'function' ? '' : param._tags,
type: param._type,
required: (describe.valids && describe.valids.indexOf(undefined) !== -1)? false : true
});
}else{
// pre version 2.x of HAPI
paramsData.push({
name: key,
description: typeof param.description === 'function' ? '' : param.description,
notes: typeof param.notes === 'function' ? '' : param.notes,
tags: typeof param.tags === 'function' ? '' : param.tags,
type: param.type,
required: param.__modifiers && param.__modifiers._values ? param.__modifiers._values.some(internals.isRequiredParam) : null,
});
}
}

@@ -276,0 +292,0 @@ return paramsData;

{
"name": "hapi-swagger",
"description": "A swagger documentation UI generator plugin for hapi",
"version": "0.0.6",
"version": "0.1.1",
"author": "Glenn Jones",
"repository": {
"type" : "git",
"url" : "http://github.com/glennjones/hapi-swagger.git"
"repository": {
"type": "git",
"url": "http://github.com/glennjones/hapi-swagger.git"
},

@@ -20,6 +20,6 @@ "main": "index",

"dependencies": {
"hoek": "0.8.x",
"boom": "0.4.x",
"joi": "0.3.x",
"handlebars": "1.0.x"
"handlebars": "1.0.x",
"boom": "~2.0.0",
"hoek": "~1.4.1",
"joi": "~2.3.1"
},

@@ -34,4 +34,4 @@ "devDependencies": {

"peerDependencies": {
"hapi": "1.x.x"
"hapi": "~2.1.1"
}
}

@@ -6,3 +6,5 @@ # hapi-swagger

__UPDATED__: now works with version 2 of HAPI
## Install

@@ -25,3 +27,3 @@

server.pack.allow({ ext: true }).require('hapi-swagger', swaggerOptions, function (err) {
server.pack.require('hapi-swagger', swaggerOptions, function (err) {
if (!err && err !== null) {

@@ -128,2 +130,4 @@ server.log(['error'], 'Plugin "hapi-swagger" load error: ' + err)

* David Waterston (https://github.com/davidwaterston)
* Jozz (https://github.com/jozzhart)
* John Oliva (https://github.com/joliva)

@@ -130,0 +134,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc