From 579c2f92725088534c90518eaf325fbae4892926 Mon Sep 17 00:00:00 2001 From: Paul Wayper Date: Thu, 8 Nov 2018 16:59:49 +1100 Subject: [PATCH] Skip optional parameters where the value is null in the supplied custom values --- lib/process.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/process.js b/lib/process.js index a43c83a..ce92b64 100644 --- a/lib/process.js +++ b/lib/process.js @@ -267,6 +267,10 @@ function processParams(code, op, path, options) { op.getParameters().forEach(function (param, ndx, arr) { var customValue = lookupCustomValue(param.name, param.in, code, op.method, path.path, options) + // Skip optional parameter with specifically nulled custom value + if (customValue === null && (! param.required)) { + return + } if (param.in === 'body') { params.body = customValue !== undefined ? customValue : param.getSample() @@ -291,6 +295,10 @@ function processParams(code, op, path, options) { path.getParameters().forEach(function (param, ndx, arr) { var customValue = lookupCustomValue(param.name, param.in, code, op.method, path.path, options) + // Skip optional parameter with specifically nulled custom value + if (customValue === null && (! param.required)) { + return + } params.path = pathify(params.path, param, customValue) })