diff --git a/.changes/next-release/bugfix-ParamValidator-b021ee76.json b/.changes/next-release/bugfix-ParamValidator-b021ee76.json new file mode 100644 index 0000000000..89a55581e3 --- /dev/null +++ b/.changes/next-release/bugfix-ParamValidator-b021ee76.json @@ -0,0 +1,5 @@ +{ + "type": "bugfix", + "category": "ParamValidator", + "description": "fix the issue that the ParamValidator always fails on the document trait" +} \ No newline at end of file diff --git a/lib/param_validator.js b/lib/param_validator.js index 817f25463f..2875663e9f 100644 --- a/lib/param_validator.js +++ b/lib/param_validator.js @@ -53,6 +53,8 @@ AWS.ParamValidator = AWS.util.inherit({ validateStructure: function validateStructure(shape, params, context) { this.validateType(params, context, ['object'], 'structure'); + if (shape.isDocument) return true; + var paramName; for (var i = 0; shape.required && i < shape.required.length; i++) { paramName = shape.required[i]; diff --git a/test/param_validator.spec.js b/test/param_validator.spec.js index 5ee20559d8..ad844842f9 100644 --- a/test/param_validator.spec.js +++ b/test/param_validator.spec.js @@ -223,6 +223,10 @@ type: 'integer' } } + }, + hash3: { + type: 'structure', + document: true } } } @@ -271,6 +275,13 @@ } }); }); + it('accepts document type members', function () { + return expectValid({ + hash1: { + hash3: {foo: 'foo', bar: ['bar']} + } + }); + }); return it('does not check inherited properties on parameters', function() { var cls, obj; cls = function() {