Skip to content

Commit 55e717e

Browse files
author
Phil Sturgeon
committed
tests for strictMode:false params
1 parent 7d86816 commit 55e717e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

lib/converters/parameter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ function convertFromParameter(parameter, options) {
1212
} else {
1313
if (options.strictMode) {
1414
throw new InvalidInputError('OpenAPI parameter must have either a \'schema\' or a \'content\' property');
15-
}
15+
}
16+
return convertParameterSchema(parameter, {}, options);
1617
}
1718
}
1819

test/parameter.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,25 @@ test('throwing on OpenAPI 3.0 parameters without schemas', function(assert) {
182182

183183
assert.throws(function() { convert.fromParameter(schema); }, /InvalidInputError/);
184184
});
185+
186+
test('doesnt throw for parameters without schemas with stricMode disabled', function(assert) {
187+
var schema
188+
, result
189+
, expected
190+
;
191+
192+
assert.plan(1);
193+
194+
schema = {
195+
name: 'parameter name',
196+
in: 'cookie',
197+
};
198+
199+
result = convert.fromParameter(schema, { strictMode : false });
200+
201+
expected = {
202+
$schema: 'http://json-schema.org/draft-04/schema#',
203+
};
204+
205+
assert.deepEqual(result, expected, 'parameter description used');
206+
});

0 commit comments

Comments
 (0)