- @override
Returns all APIResponses for operation.
Source
@override
List<APIResponse> documentResponsesForOperation(APIOperation operation) {
List<APIResponse> responses = [
new APIResponse()
..statusCode = 500
..description = "Something went wrong"
..schema = new APISchemaObject(
properties: {"error": new APISchemaObject.string()})
];
var symbol = APIOperation.symbolForID(operation.id, this);
if (symbol != null) {
var controllerCache = HTTPControllerBinder.binderForType(runtimeType);
var methodMirror = reflect(this).type.declarations[symbol];
if (controllerCache.hasRequiredBindingsForMethod(methodMirror)) {
responses.add(new APIResponse()
..statusCode = HttpStatus.BAD_REQUEST
..description = "Missing required query and/or header parameter(s)."
..schema = new APISchemaObject(
properties: {"error": new APISchemaObject.string()}));
}
}
return responses;
}