Add path param description support
This commit is contained in:
parent
d9accd0593
commit
e0bb94e439
3 changed files with 25 additions and 2 deletions
|
@ -39,6 +39,11 @@ def swagger_route_data(include_internal=False, compact=False):
|
|||
|
||||
if 'view_class' in dir(endpoint_method):
|
||||
view_class = endpoint_method.view_class
|
||||
|
||||
param_data_map = {}
|
||||
if '__api_path_params' in dir(view_class):
|
||||
param_data_map = view_class.__api_path_params
|
||||
|
||||
operations = []
|
||||
|
||||
method_names = list(rule.methods.difference(['HEAD', 'OPTIONS']))
|
||||
|
@ -46,12 +51,13 @@ def swagger_route_data(include_internal=False, compact=False):
|
|||
method = getattr(view_class, method_name.lower(), None)
|
||||
|
||||
parameters = []
|
||||
|
||||
for param in rule.arguments:
|
||||
parameters.append({
|
||||
'paramType': 'path',
|
||||
'name': param,
|
||||
'dataType': 'string',
|
||||
'description': 'Param description.',
|
||||
'description': param_data_map.get(param, {'description': ''})['description'],
|
||||
'required': True,
|
||||
})
|
||||
|
||||
|
|
Reference in a new issue