protected void calculatePath(HandlerMethod handlerMethod, RouterOperation routerOperation, Locale locale, OpenAPI openAPI) {
		routerOperation = customizeRouterOperation(routerOperation, handlerMethod);

		String operationPath = routerOperation.getPath();
		Set<RequestMethod> requestMethods = new TreeSet<>(Arrays.asList(routerOperation.getMethods()));
		io.swagger.v3.oas.annotations.Operation apiOperation = routerOperation.getOperation();
		String[] methodConsumes = routerOperation.getConsumes();
		String[] methodProduces = routerOperation.getProduces();
		String[] headers = routerOperation.getHeaders();
		Map<String, String> queryParams = routerOperation.getQueryParams();

		Components components = openAPI.getComponents();
		Paths paths = openAPI.getPaths();

		Map<HttpMethod, Operation> operationMap = null;
		if (paths.containsKey(operationPath)) {
			PathItem pathItem = paths.get(operationPath);
			operationMap = pathItem.readOperationsMap();
		}

		JavadocProvider javadocProvider = operationParser.getJavadocProvider();

		for (RequestMethod requestMethod : requestMethods) {
			Operation existingOperation = getExistingOperation(operationMap, requestMethod);
			Method method = handlerMethod.getMethod();
			// skip hidden operations
			if (operationParser.isHidden(method))
				continue;

			RequestMapping reqMappingClass = AnnotatedElementUtils.findMergedAnnotation(handlerMethod.getBeanType(),
					RequestMapping.class);

			MethodAttributes methodAttributes = new MethodAttributes(springDocConfigProperties.getDefaultConsumesMediaType(), springDocConfigProperties.getDefaultProducesMediaType(), methodConsumes, methodProduces, headers, locale);
			methodAttributes.setMethodOverloaded(existingOperation != null);
			//Use the javadoc return if present
			if (javadocProvider != null) {
				methodAttributes.setJavadocReturn(javadocProvider.getMethodJavadocReturn(handlerMethod.getMethod()));
			}

			if (reqMappingClass != null) {
				methodAttributes.setClassConsumes(reqMappingClass.consumes());
				methodAttributes.setClassProduces(reqMappingClass.produces());
			}

			methodAttributes.calculateHeadersForClass(method.getDeclaringClass());
			methodAttributes.calculateConsumesProduces(method);

			Operation operation = (existingOperation != null) ? existingOperation : new Operation();

			if (isDeprecated(method))
				operation.setDeprecated(true);

			// Add documentation from operation annotation
			if (apiOperation == null || StringUtils.isBlank(apiOperation.operationId()))
				apiOperation = AnnotatedElementUtils.findMergedAnnotation(method,
						io.swagger.v3.oas.annotations.Operation.class);

			calculateJsonView(apiOperation, methodAttributes, method);
			if (apiOperation != null)
				openAPI = operationParser.parse(apiOperation, operation, openAPI, methodAttributes);
			fillParametersList(operation, queryParams, methodAttributes);

			// compute tags
			operation = openAPIService.buildTags(handlerMethod, operation, openAPI, locale);

			io.swagger.v3.oas.annotations.parameters.RequestBody requestBodyDoc = AnnotatedElementUtils.findMergedAnnotation(method,
					io.swagger.v3.oas.annotations.parameters.RequestBody.class);

			// RequestBody in Operation
			requestBuilder.getRequestBodyBuilder()
					.buildRequestBodyFromDoc(requestBodyDoc, methodAttributes, components,
							methodAttributes.getJsonViewAnnotationForRequestBody(), locale)
					.ifPresent(operation::setRequestBody);
			// requests
			operation = requestBuilder.build(handlerMethod, requestMethod, operation, methodAttributes, openAPI);

			// responses
			ApiResponses apiResponses = responseBuilder.build(components, handlerMethod, operation, methodAttributes);
			operation.setResponses(apiResponses);

			// get javadoc method description
			if (javadocProvider != null) {
				String description = javadocProvider.getMethodJavadocDescription(handlerMethod.getMethod());
				String summary = javadocProvider.getFirstSentence(description);
				boolean emptyOverrideDescription = StringUtils.isEmpty(operation.getDescription());
				boolean emptyOverrideSummary = StringUtils.isEmpty(operation.getSummary());
				if (!StringUtils.isEmpty(description) && emptyOverrideDescription) {
					operation.setDescription(description);
				}
				// if there is a previously set description
				// but no summary then it is intentional
				// we keep it as is
				if (!StringUtils.isEmpty(summary) && emptyOverrideSummary && emptyOverrideDescription) {
					operation.setSummary(javadocProvider.getFirstSentence(description));
				}
			}

			Set<io.swagger.v3.oas.annotations.callbacks.Callback> apiCallbacks = AnnotatedElementUtils.findMergedRepeatableAnnotations(method, io.swagger.v3.oas.annotations.callbacks.Callback.class);

			// callbacks
			buildCallbacks(openAPI, methodAttributes, operation, apiCallbacks);

			// allow for customisation
			operation = customizeOperation(operation, components, handlerMethod);

			if (StringUtils.contains(operationPath, "*")) {
				Matcher matcher = pathPattern.matcher(operationPath);
				while (matcher.find()) {
					String pathParam = matcher.group(1);
					String newPathParam = pathParam.replace("*", "");
					operationPath = operationPath.replace("{" + pathParam + "}", "{" + newPathParam + "}");
				}
			}

			PathItem pathItemObject = buildPathItem(requestMethod, operation, operationPath, paths);
			paths.addPathItem(operationPath, pathItemObject);
		}
	}
Calculate path.

@param handlerMethod   the handler method
@param routerOperation the router operation
@param locale          the locale
@param openAPI         the open api
springdoc-openapi-starter-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java