From efdb99f8cecc4afb592afad79c761081d5d5cf22 Mon Sep 17 00:00:00 2001 From: lee <4766465@qq.com> Date: Wed, 18 Dec 2024 13:27:00 +0800 Subject: [PATCH] init --- yami-shop-api/src/main/java/com/yami/shop/api/config/SwaggerConfiguration.java | 67 +++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-) diff --git a/yami-shop-api/src/main/java/com/yami/shop/api/config/SwaggerConfiguration.java b/yami-shop-api/src/main/java/com/yami/shop/api/config/SwaggerConfiguration.java new file mode 100644 index 0000000..42f3eab --- /dev/null +++ b/yami-shop-api/src/main/java/com/yami/shop/api/config/SwaggerConfiguration.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. + * + * https://www.mall4j.com/ + * + * 未经允许,不可做商业用途! + * + * 版权所有,侵权必究! + */ +package com.yami.shop.api.config; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.yami.shop.common.util.PageParam; +import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import jodd.util.ArraysUtil; +import org.apache.commons.lang3.reflect.FieldUtils; +import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.*; +import org.springdoc.core.customizers.DelegatingMethodParameterCustomizer; +import org.springdoc.core.providers.ObjectMapperProvider; +import org.springdoc.core.providers.WebConversionServiceProvider; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.MethodParameter; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * Swagger文档,只有在测试环境才会使用 + * @author LGH + */ +@Configuration +public class SwaggerConfiguration { + + + @Bean + public GroupedOpenApi publicApi() { + return GroupedOpenApi.builder() + .group("公共接口") + .packagesToScan("com.yami.shop.api") + .pathsToMatch("/**") + .build(); + } + + @Bean + public OpenAPI springShopOpenAPI() { + return new OpenAPI() + .info(new Info().title("Mall4j接口文档") + .description("Mall4j宇宙版接口文档,openapi3.0 接口,用于前端对接") + .version("v0.0.1") + .license(new License().name("使用请遵守商用授权协议").url("https://www.mall4j.com"))); + } + +} -- Gitblit v1.9.3