Skip to content

Commit c4c1c3a

Browse files
authored
Merge pull request #610 from dstrigl/issue-609
Fix @api.expect() decorators with validate=False (issue-609)
2 parents 2d77f8f + daa7b41 commit c4c1c3a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changelog
66
Current
77
-------
88

9+
- Fix `@api.expect(..., validate=False)` decorators for an :class:`Api` where `validate=True` is set on the constructor
910
- Ensure `basePath` is always a path
1011

1112
0.12.1 (2018-09-28)

flask_restplus/namespace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def expect(self, *inputs, **kwargs):
203203
'''
204204
expect = []
205205
params = {
206-
'validate': kwargs.get('validate', None) or self._validate,
206+
'validate': kwargs.get('validate', self._validate),
207207
'expect': expect
208208
}
209209
for param in inputs:

tests/test_payload.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ class ValidationOff(restplus.Resource):
7979
def post(self):
8080
return {}
8181

82-
self.assert_errors(client, '/validation/', {}, 'name')
82+
data = client.post_json('/validation/', {})
83+
assert data == {}
8384

8485
def _setup_api_format_checker_tests(self, app, format_checker=None):
8586
class IPAddress(restplus.fields.Raw):

0 commit comments

Comments
 (0)