Add response schema validation (only when in TESTING mode) and add one schema. More will be added in a followup CL

This commit is contained in:
Joseph Schorr 2014-08-27 20:57:46 -04:00
parent 4fd249589d
commit 6f1a4030b6
3 changed files with 78 additions and 4 deletions

View file

@ -94,12 +94,18 @@ def swagger_route_data(include_internal=False, compact=False):
new_operation = {
'method': method_name,
'nickname': method_metadata(method, 'nickname')
'nickname': method_metadata(method, 'nickname') or '(unnamed)'
}
if not compact:
response_type = 'void'
res_schema_name = method_metadata(method, 'response_schema')
if res_schema_name:
models[res_schema_name] = view_class.schemas[res_schema_name]
response_type = res_schema_name
new_operation.update({
'type': 'void',
'type': response_type,
'summary': method.__doc__.strip() if method.__doc__ else '',
'parameters': parameters,
})