From 1af0c068b0a873a1df3b02039a200c3860acb86e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com>
Date: Sun, 7 Apr 2024 12:50:25 +0800
Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96swagger=20=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pig-common/pig-common-bom/pom.xml | 2 +-
pig-common/pig-common-swagger/pom.xml | 4 ++++
.../pig/common/swagger/annotation/EnablePigDoc.java | 3 +++
.../src/main/resources/openapi-config.yaml | 7 +++++++
4 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 pig-common/pig-common-swagger/src/main/resources/openapi-config.yaml
diff --git a/pig-common/pig-common-bom/pom.xml b/pig-common/pig-common-bom/pom.xml
index 1fd4d3c7..b392d9dd 100644
--- a/pig-common/pig-common-bom/pom.xml
+++ b/pig-common/pig-common-bom/pom.xml
@@ -22,7 +22,7 @@
1.8
1.2.83
3.0.3
- 1.8.0
+ 1.6.9
2.2.0
3.5.5
4.3.0
diff --git a/pig-common/pig-common-swagger/pom.xml b/pig-common/pig-common-swagger/pom.xml
index e3974c73..03b55e42 100644
--- a/pig-common/pig-common-swagger/pom.xml
+++ b/pig-common/pig-common-swagger/pom.xml
@@ -69,5 +69,9 @@
spring-webmvc
provided
+
+ com.pig4cloud
+ pig-common-core
+
diff --git a/pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/annotation/EnablePigDoc.java b/pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/annotation/EnablePigDoc.java
index 1ddf61ef..a9b0de24 100644
--- a/pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/annotation/EnablePigDoc.java
+++ b/pig-common/pig-common-swagger/src/main/java/com/pig4cloud/pig/common/swagger/annotation/EnablePigDoc.java
@@ -16,10 +16,12 @@
package com.pig4cloud.pig.common.swagger.annotation;
+import com.pig4cloud.pig.common.core.factory.YamlPropertySourceFactory;
import com.pig4cloud.pig.common.swagger.config.OpenAPIDefinitionImportSelector;
import com.pig4cloud.pig.common.swagger.support.SwaggerProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.PropertySource;
import java.lang.annotation.*;
@@ -35,6 +37,7 @@ import java.lang.annotation.*;
@Inherited
@EnableConfigurationProperties(SwaggerProperties.class)
@Import({ OpenAPIDefinitionImportSelector.class })
+@PropertySource(value = "classpath:openapi-config.yaml", factory = YamlPropertySourceFactory.class)
public @interface EnablePigDoc {
/**
diff --git a/pig-common/pig-common-swagger/src/main/resources/openapi-config.yaml b/pig-common/pig-common-swagger/src/main/resources/openapi-config.yaml
new file mode 100644
index 00000000..f1823a02
--- /dev/null
+++ b/pig-common/pig-common-swagger/src/main/resources/openapi-config.yaml
@@ -0,0 +1,7 @@
+# swagger 配置
+swagger:
+ enabled: true
+ title: Pig Swagger API
+ gateway: http://${GATEWAY-HOST:pig-gateway}:${GATEWAY-PORT:9999}
+ token-url: ${swagger.gateway}/auth/oauth2/token
+ scope: server