Open lamehost opened 6 years ago
Dirty fix:
Replace:
param = {
'name': self.name,
'in': LOCATIONS.get(self.location, 'query')
}
With:
location_str = 'query'
if isinstance(self.location, list):
location_str = ', '.join(list(set([_ for _ in self.location if _ in LOCATIONS])))
else:
location_str = LOCATIONS.get(self.location, 'query')
Same bug here.
with
operation_arguments6 = api.parser()
operation_arguments6.add_argument('a', required=True, help='A number', location=['form','args'])
operation_arguments6.add_argument('b', required=True, help='A number', location=['form','args'])
result
parser_params = dict((p['name'], p) for p in expect.__schema__)
File "/Users/nomorgan/WORK/stella/workspace/feature_darwin/macos/miniconda/4_2_12_PYTHON3@x64/envs/celery-flask-samples-2/lib/python3.6/site-packages/flask_restplus/reqparse.py", line 397, in __schema__
param = arg.__schema__
File "/Users/nomorgan/WORK/stella/workspace/feature_darwin/macos/miniconda/4_2_12_PYTHON3@x64/envs/celery-flask-samples-2/lib/python3.6/site-packages/flask_restplus/reqparse.py", line 265, in __schema__
'in': LOCATIONS.get(self.location, 'query')
TypeError: unhashable type: 'list'
My requirements.txt
Flask==0.12
flask-restplus==0.10.1
Issue still occurs in 0.12.1, although documentation clearly states that this is possible.
@lamehost make location a tuple. see https://github.com/noirbizarre/flask-restplus/blob/4609dc17e8ea04033984aa0f06c4d583ecf16aca/flask_restplus/reqparse.py#L98
Hello,
Multiple argument locations like the following
Breaks documentation:
Issue is LOCATIONS.get(self.location, 'query') assumes self.location is string .