Add back error_message and error_type for backwards-compatibility

This commit is contained in:
Evan Cordell 2016-04-13 09:02:24 -04:00
parent 7b44beb1fd
commit e1b3312495
2 changed files with 35 additions and 25 deletions

View file

@ -180,30 +180,38 @@ def swagger_route_data(include_internal=False, compact=False):
models[response_schema_name] = view_class.schemas[response_schema_name]
models['ApiError'] = {
'type': 'object',
'properties': {
'status': {
'type': 'integer',
'description': 'Status code of the response.'
},
'type': {
'type': 'string',
'description': 'Reference to the type of the error.'
},
'detail': {
'type': 'string',
'description': 'Details about the specific instance of the error.'
},
'title': {
'type': 'string',
'description': 'Unique error code to identify the type of error.'
}
'type': 'object',
'properties': {
'status': {
'type': 'integer',
'description': 'Status code of the response.'
},
'required': [
'status',
'type',
'title',
]
'type': {
'type': 'string',
'description': 'Reference to the type of the error.'
},
'detail': {
'type': 'string',
'description': 'Details about the specific instance of the error.'
},
'title': {
'type': 'string',
'description': 'Unique error code to identify the type of error.'
},
'error_message': {
'type': 'string',
'description': 'Deprecated; alias for detail'
},
'error_type': {
'type': 'string',
'description': 'Deprecated; alias for detail'
}
},
'required': [
'status',
'type',
'title',
]
}
responses = {
@ -224,8 +232,8 @@ def swagger_route_data(include_internal=False, compact=False):
},
}
for status, body in responses.items():
body['schema'] = {'$ref': '#/definitions/ApiError'}
for _, body in responses.items():
body['schema'] = {'$ref': '#/definitions/ApiError'}
if method_name == 'DELETE':
responses['204'] = {