From bf5c206bd612e3ab15bd177afcdade4646e15ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 11 Oct 2016 16:31:57 +0200 Subject: [PATCH] Fix description of updateAll response Correctly describe the first non-error callback arg as an `info` object containing a `count` property. --- lib/persisted-model.js | 13 +++++++++---- test/remoting.integration.js | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/persisted-model.js b/lib/persisted-model.js index 3e4530e6..ccbe2596 100644 --- a/lib/persisted-model.js +++ b/lib/persisted-model.js @@ -795,10 +795,15 @@ module.exports = function(registry) { description: 'An object of model property name/value pairs'}, ], returns: { - arg: 'count', - description: 'The number of instances updated', - type: 'object', - root: true + arg: 'info', + description: 'Information related to the outcome of the operation', + type: { + count: { + type: 'number', + description: 'The number of instances updated', + }, + }, + root: true, }, http: {verb: 'post', path: '/update'} }); diff --git a/test/remoting.integration.js b/test/remoting.integration.js index 41ec366e..f881ca4e 100644 --- a/test/remoting.integration.js +++ b/test/remoting.integration.js @@ -269,6 +269,12 @@ function formatReturns(m) { return ''; } var type = returns[0].type; + + // handle anonymous type definitions, e.g + // { arg: 'info', type: { count: 'number' } } + if (typeof type === 'object' && !Array.isArray(type)) + type = 'object'; + return type ? ':' + type : ''; }