private void buildApiResponses(Components components, MethodParameter methodParameter, ApiResponses apiResponsesOp,
			MethodAttributes methodAttributes, String httpCode, ApiResponse apiResponse, boolean isGeneric) {
		// No documentation
		if (StringUtils.isBlank(apiResponse.get$ref())) {
			if (apiResponse.getContent() == null) {
				Content content = buildContent(components, methodParameter, methodAttributes.getMethodProduces(),
						methodAttributes.getJsonViewAnnotation());
				apiResponse.setContent(content);
			}
			else if (CollectionUtils.isEmpty(apiResponse.getContent()))
				apiResponse.setContent(null);
			if (StringUtils.isBlank(apiResponse.getDescription())) {
				// use javadoc
				if (!StringUtils.isBlank(methodAttributes.getJavadocReturn()))
					apiResponse.setDescription(methodAttributes.getJavadocReturn());
				else
					setDescription(httpCode, apiResponse);
			}
		}
		if (apiResponse.getContent() != null && (methodAttributes.isUseReturnTypeSchema() ||
				((isGeneric || methodAttributes.isMethodOverloaded()) && methodAttributes.isNoApiResponseDoc()))) {
			// Merge with existing schema
			Content existingContent = apiResponse.getContent();
			Type type = GenericTypeResolver.resolveType(methodParameter.getGenericParameterType(), methodParameter.getContainingClass());
			Schema<?> schemaN = calculateSchema(components, type,
					methodAttributes.getJsonViewAnnotation(), getParameterAnnotations(methodParameter));
			if (schemaN != null && ArrayUtils.isNotEmpty(methodAttributes.getMethodProduces()))
				Arrays.stream(methodAttributes.getMethodProduces()).forEach(mediaTypeStr -> mergeSchema(existingContent, schemaN, mediaTypeStr));
		}
		if (springDocConfigProperties.isOverrideWithGenericResponse()
				&& methodParameter.getExecutable().isAnnotationPresent(ExceptionHandler.class)) {
			// ExceptionHandler's exception class resolution is non-trivial
			// more info on its javadoc
			Set<Class<?>> exceptions = getExceptionsFromExceptionHandler(methodParameter);
			apiResponse.addExtension(EXTENSION_EXCEPTION_CLASSES, exceptions);
		}
		apiResponsesOp.addApiResponse(httpCode, apiResponse);
	}
Build api responses.

@param components       the components
@param methodParameter  the method parameter
@param apiResponsesOp   the api responses op
@param methodAttributes the method attributes
@param httpCode         the http code
@param apiResponse      the api response
@param isGeneric        the is generic
springdoc-openapi-starter-common/src/main/java/org/springdoc/core/service/GenericResponseService.java