private Type getType(MethodParameter methodParameterReturn, RequestMethod requestMethod, DataRestRepository dataRestRepository, ResourceMetadata resourceMetadata) {
		Type returnType = GenericTypeResolver.resolveType(methodParameterReturn.getGenericParameterType(), methodParameterReturn.getContainingClass());
		Class returnedEntityType = dataRestRepository.getReturnType();

		if (returnType instanceof ParameterizedType parameterizedType) {
			if ((ResponseEntity.class.equals(parameterizedType.getRawType()))) {
				return getTypeForResponseEntity(requestMethod, dataRestRepository, returnedEntityType, parameterizedType);
			}
			else if ((HttpEntity.class.equals(parameterizedType.getRawType())
					&& parameterizedType.getActualTypeArguments()[0] instanceof ParameterizedType wildcardTypeUpperBound)) {
				if (RepresentationModel.class.equals(wildcardTypeUpperBound.getRawType())) {
					return resolveGenericType(HttpEntity.class, RepresentationModel.class, returnedEntityType);
				}
			}
			else if ((CollectionModel.class.equals(parameterizedType.getRawType())
					&& parameterizedType.getActualTypeArguments()[0] != null)) {
				return getTypeForCollectionModel(returnedEntityType, resourceMetadata.isPagingResource());
			}
		}
		return returnType;
	}
Gets type.

@param methodParameterReturn the method parameter return
@param requestMethod         the request method
@param dataRestRepository    the data rest repository
@param resourceMetadata      the resource metadata
@return the type
springdoc-openapi-starter-common/src/main/java/org/springdoc/core/data/DataRestResponseService.java