private List<Map<String, Object>> determineResponses(Method method) { final List<Map<String, Object>> result = Lists.newArrayList(); final ApiResponses annotation = method.getAnnotation(ApiResponses.class); if (null != annotation) { for (ApiResponse response : annotation.value()) { final Map<String, Object> responseDescription = ImmutableMap.<String, Object>of( "code", response.code(), "message", response.message()); result.add(responseDescription); } } return result; }
Class<?> responseClass = apiResponse.response(); Response response = new Response() .description(apiResponse.message()) .headers(responseHeaders);
private static ResponseConfig convert(ApiResponse apiResponse) { ResponseConfig responseConfig = new ResponseConfig(); responseConfig.setCode(apiResponse.code()); responseConfig.setDescription(apiResponse.message()); responseConfig.setResponseClass(apiResponse.response()); responseConfig.setResponseContainer(apiResponse.responseContainer()); responseConfig.setResponseReference(apiResponse.reference()); responseConfig.setResponseHeaders(apiResponse.responseHeaders()); return responseConfig; }
private List<Map<String, Object>> determineResponses(Method method) { final List<Map<String, Object>> result = Lists.newArrayList(); final ApiResponses annotation = method.getAnnotation(ApiResponses.class); if (null != annotation) { for (ApiResponse response : annotation.value()) { final Map<String, Object> responseDescription = ImmutableMap.<String, Object>of( "code", response.code(), "message", response.message()); result.add(responseDescription); } } return result; }
private ResponseEntity<?> handleNoteNotFoundException(NoteNotFoundException e, HandlerMethod handlerMethod) { ApiResponse apiResponse = getApiResponseForErrorCode(404, handlerMethod); Error error = new Error().message(apiResponse != null ? apiResponse.message() : "Note not found:" + e.getNoteId()); return new ResponseEntity<Error>(error, HttpStatus.NOT_FOUND); }
Arrays.asList(apiResponses.value()) .forEach(apiResponse -> { Response responseMessage = new Response().description(apiResponse.message()); RefProperty responseObject = new RefProperty();
.message(apiResponse.message()) .responseModel(responseModel.orNull()) .headersWithDescription(headers)
.description(apiResponse.message()) .headers(responseHeaders);
private static ResponseConfig convert(ApiResponse apiResponse) { ResponseConfig responseConfig = new ResponseConfig(); responseConfig.setCode(apiResponse.code()); responseConfig.setDescription(apiResponse.message()); responseConfig.setResponseClass(apiResponse.response()); responseConfig.setResponseContainer(apiResponse.responseContainer()); responseConfig.setResponseReference(apiResponse.reference()); responseConfig.setResponseHeaders(apiResponse.responseHeaders()); return responseConfig; }
apiResponse.responseHeaders()); final Response response = new Response().description(apiResponse.message()) .headers(responseHeaders);
ResponseCode rc = new ResponseCode(this); rc.setCode(swaggerResponse.code()); rc.setCondition(swaggerResponse.message());
private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
@SuppressWarnings("deprecation") private void addResponse(Operation operation, ApiResponse apiResponse, JsonView jsonView) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders(), jsonView); Map<String, Object> examples = parseExamples(apiResponse.examples()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); response.setExamples(examples); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType, jsonView); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
private void addResponse(Operation operation, ApiResponse apiResponse, JsonView jsonView) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders(), jsonView); Map<String, Object> examples = parseExamples(apiResponse.examples()); Response response = new Response() .description(apiResponse.message()) .headers(responseHeaders); response.setExamples(examples); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType, jsonView); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }