Java Code Examples for springfox.documentation.spi.service.contexts.OperationContext#alternateFor()
The following examples show how to use
springfox.documentation.spi.service.contexts.OperationContext#alternateFor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApiMethodReader.java From swagger-more with Apache License 2.0 | 6 votes |
private void readReturnDescription(OperationContext context, ApiMethod apiMethod) { ResolvedType returnType = context.alternateFor(context.getReturnType()); String message = StringUtils.isEmpty(apiMethod.returnDescription()) ? "成功" : apiMethod.returnDescription(); ModelReference modelRef = null; if (!isVoid(returnType)) { ModelContext modelContext = ModelContext.returnValue( context.getGroupName(), returnType, context.getDocumentationType(), context.getAlternateTypeProvider(), context.getGenericsNamingStrategy(), context.getIgnorableParameterTypes()); modelRef = modelRefFactory(modelContext, typeNameExtractor).apply(returnType); } ResponseMessage built = new ResponseMessageBuilder() .code(HttpStatus.OK.value()) .message(message) .responseModel(modelRef) .build(); context.operationBuilder().responseMessages(newHashSet(built)); }
Example 2
Source File: RequestToPoOperationBuilder.java From jframework with Apache License 2.0 | 5 votes |
private List<Parameter> readParameters(final OperationContext context) { List<ResolvedMethodParameter> methodParameters = context.getParameters(); final List<Parameter> parameterList = new ArrayList<>(); for (ResolvedMethodParameter methodParameter : methodParameters) { ResolvedType alternate = context.alternateFor(methodParameter.getParameterType()); if (!shouldIgnore(methodParameter, alternate, context.getIgnorableParameterTypes()) && isRequestFormToPojo(methodParameter)) { readRequestFormToPojo(context, methodParameter); } } return parameterList.stream().filter(((Predicate<Parameter>) Parameter::isHidden).negate()).collect(Collectors.toList()); }
Example 3
Source File: SuccessPlugin.java From BlogManagePlatform with Apache License 2.0 | 4 votes |
private ModelReference resolveModel(OperationContext context, Success success) { ModelContext modelContext = SwaggerUtil.resolveModelContext(context, success.value()); ResolvedType type = context.alternateFor(SwaggerUtil.resolvedType(typeResolver, success)); return modelRefFactory(modelContext, typeNameExtractor).apply(type); }