use of org.springdoc.core.Constants.OPERATION_ATTRIBUTE in project springdoc-openapi by springdoc.
the class AbstractOpenApiResource method getRouterFunctionPaths.
/**
* Gets router function paths.
*
* @param beanName the bean name
* @param routerFunctionVisitor the router function visitor
* @param locale the locale
*/
protected void getRouterFunctionPaths(String beanName, AbstractRouterFunctionVisitor routerFunctionVisitor, Locale locale) {
boolean withRouterOperation = routerFunctionVisitor.getRouterFunctionDatas().stream().anyMatch(routerFunctionData -> routerFunctionData.getAttributes().containsKey(OPERATION_ATTRIBUTE));
if (withRouterOperation) {
List<RouterOperation> operationList = routerFunctionVisitor.getRouterFunctionDatas().stream().map(RouterOperation::new).collect(Collectors.toList());
calculatePath(operationList, locale);
} else {
List<org.springdoc.core.annotations.RouterOperation> routerOperationList = new ArrayList<>();
ApplicationContext applicationContext = openAPIService.getContext();
RouterOperations routerOperations = applicationContext.findAnnotationOnBean(beanName, RouterOperations.class);
if (routerOperations == null) {
org.springdoc.core.annotations.RouterOperation routerOperation = applicationContext.findAnnotationOnBean(beanName, org.springdoc.core.annotations.RouterOperation.class);
if (routerOperation != null)
routerOperationList.add(routerOperation);
} else
routerOperationList.addAll(Arrays.asList(routerOperations.value()));
if (routerOperationList.size() == 1)
calculatePath(routerOperationList.stream().map(routerOperation -> new RouterOperation(routerOperation, routerFunctionVisitor.getRouterFunctionDatas().get(0))).collect(Collectors.toList()), locale);
else {
List<RouterOperation> operationList = routerOperationList.stream().map(RouterOperation::new).collect(Collectors.toList());
mergeRouters(routerFunctionVisitor.getRouterFunctionDatas(), operationList);
calculatePath(operationList, locale);
}
}
}
Aggregations