Add support for `context` and `res` param types
This commit is contained in:
parent
d1084950a9
commit
856d34b9d4
|
@ -61,7 +61,12 @@ var routeHelper = module.exports = {
|
|||
if (typeof arg.http === 'function') return false;
|
||||
// Don't show arguments set to the incoming http request.
|
||||
// Please note that body needs to be shown, such as User.create().
|
||||
if (arg.http.source === 'req') return false;
|
||||
if (arg.http.source === 'req' ||
|
||||
arg.http.source === 'res' ||
|
||||
arg.http.source === 'context') {
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
|
@ -109,6 +109,40 @@ describe('route-helper', function() {
|
|||
});
|
||||
expect(doc.operations[0].parameters[0].description).to.equal('line1\nline2');
|
||||
});
|
||||
|
||||
it('correctly does not include context params', function() {
|
||||
var doc = createAPIDoc({
|
||||
accepts: [
|
||||
{arg: 'ctx', http: {source: 'context'}}
|
||||
],
|
||||
path: '/test'
|
||||
});
|
||||
var params = doc.operations[0].parameters;
|
||||
expect(params.length).to.equal(0);
|
||||
});
|
||||
|
||||
it('correctly does not include request params', function() {
|
||||
var doc = createAPIDoc({
|
||||
accepts: [
|
||||
{arg: 'req', http: {source: 'req'}}
|
||||
],
|
||||
path: '/test'
|
||||
});
|
||||
var params = doc.operations[0].parameters;
|
||||
expect(params.length).to.equal(0);
|
||||
});
|
||||
|
||||
it('correctly does not include response params', function() {
|
||||
var doc = createAPIDoc({
|
||||
accepts: [
|
||||
{arg: 'res', http: {source: 'res'}}
|
||||
],
|
||||
path: '/test'
|
||||
});
|
||||
var params = doc.operations[0].parameters;
|
||||
expect(params.length).to.equal(0);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Easy wrapper around createRoute
|
||||
|
|
Loading…
Reference in New Issue