chore: keep swagger on api apps only

This commit is contained in:
lingniu
2026-07-01 15:32:17 +08:00
parent dc56a664f4
commit 53f8f79c3e
13 changed files with 35 additions and 41 deletions

View File

@@ -109,10 +109,10 @@ curl -sS http://127.0.0.1:20300/actuator/health/liveness
curl -sS http://127.0.0.1:20300/actuator/health/readiness curl -sS http://127.0.0.1:20300/actuator/health/readiness
``` ```
Swagger API / Swagger
- GB32960 ingest: `http://127.0.0.1:20100/swagger-ui/index.html` - GB32960 ingest health: `http://127.0.0.1:20100/actuator/health`
- JT808 ingest: `http://127.0.0.1:20400/swagger-ui/index.html` - JT808 ingest health: `http://127.0.0.1:20400/actuator/health`
- Yutong MQTT ingest: `http://127.0.0.1:20500/swagger-ui/index.html` - Yutong MQTT ingest health: `http://127.0.0.1:20500/actuator/health`
- History query: `http://127.0.0.1:20200/swagger-ui/index.html` - History query: `http://127.0.0.1:20200/swagger-ui/index.html`
- Analytics metrics: `http://127.0.0.1:20300/swagger-ui/index.html` - Analytics metrics: `http://127.0.0.1:20300/swagger-ui/index.html`

View File

@@ -190,11 +190,11 @@ curl -sS http://127.0.0.1:20300/actuator/health/liveness
curl -sS http://127.0.0.1:20300/actuator/health/readiness curl -sS http://127.0.0.1:20300/actuator/health/readiness
``` ```
Swagger API / Swagger
- JT808 ingest: `http://127.0.0.1:20400/swagger-ui/index.html` - JT808 ingest health: `http://127.0.0.1:20400/actuator/health`
- GB32960 ingest: `http://127.0.0.1:20100/swagger-ui/index.html` - GB32960 ingest health: `http://127.0.0.1:20100/actuator/health`
- Yutong MQTT ingest: `http://127.0.0.1:20500/swagger-ui/index.html` - Yutong MQTT ingest health: `http://127.0.0.1:20500/actuator/health`
- History query: `http://127.0.0.1:20200/swagger-ui/index.html` - History query: `http://127.0.0.1:20200/swagger-ui/index.html`
- Analytics metrics: `http://127.0.0.1:20300/swagger-ui/index.html` - Analytics metrics: `http://127.0.0.1:20300/swagger-ui/index.html`

View File

@@ -49,10 +49,6 @@
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>

View File

@@ -28,12 +28,6 @@ spring:
server: server:
port: ${HTTP_PORT:20100} port: ${HTTP_PORT:20100}
springdoc:
swagger-ui:
path: /swagger-ui.html
api-docs:
path: /v3/api-docs
lingniu: lingniu:
ingest: ingest:
gb32960: gb32960:

View File

@@ -64,7 +64,8 @@ class Gb32960IngestAppDefaultsTest {
.doesNotContain("event-history:") .doesNotContain("event-history:")
.doesNotContain("event-file-store:") .doesNotContain("event-file-store:")
.doesNotContain("vehicle-state:") .doesNotContain("vehicle-state:")
.doesNotContain("vehicle-stat:"); .doesNotContain("vehicle-stat:")
.doesNotContain("springdoc:");
assertThat(applicationYaml()) assertThat(applicationYaml())
.contains("password: ${GB32960_PLATFORM_PWD_HYUNDAI:}") .contains("password: ${GB32960_PLATFORM_PWD_HYUNDAI:}")
.contains("password: ${GB32960_PLATFORM_PWD_YUEJIN:}") .contains("password: ${GB32960_PLATFORM_PWD_YUEJIN:}")

View File

@@ -49,10 +49,6 @@
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>

View File

@@ -28,12 +28,6 @@ spring:
server: server:
port: ${HTTP_PORT:20400} port: ${HTTP_PORT:20400}
springdoc:
swagger-ui:
path: /swagger-ui.html
api-docs:
path: /v3/api-docs
lingniu: lingniu:
ingest: ingest:
jt808: jt808:

View File

@@ -55,6 +55,7 @@ class Jt808IngestAppDefaultsTest {
.doesNotContain("event-file-store:") .doesNotContain("event-file-store:")
.doesNotContain("vehicle-state:") .doesNotContain("vehicle-state:")
.doesNotContain("vehicle-stat:") .doesNotContain("vehicle-stat:")
.doesNotContain("springdoc:")
.doesNotContain("SESSION_STORE") .doesNotContain("SESSION_STORE")
.doesNotContain("VEHICLE_IDENTITY_STORE") .doesNotContain("VEHICLE_IDENTITY_STORE")
.doesNotContain("KAFKA_ENABLED"); .doesNotContain("KAFKA_ENABLED");

View File

@@ -294,6 +294,25 @@ class MavenModuleProfileTest {
} }
} }
@Test
void springdocUiIsOnlyPackagedWithAppsThatExposeRestApis() throws Exception {
for (String appPom : List.of(
"modules/apps/gb32960-ingest-app/pom.xml",
"modules/apps/jt808-ingest-app/pom.xml",
"modules/apps/yutong-mqtt-app/pom.xml")) {
assertThat(hasDependency(modulePom(appPom), "org.springdoc", "springdoc-openapi-starter-webmvc-ui"))
.as(appPom + " exposes Actuator only; Swagger UI belongs to query/API apps")
.isFalse();
}
for (String appPom : List.of(
"modules/apps/vehicle-history-app/pom.xml",
"modules/apps/vehicle-analytics-app/pom.xml")) {
assertThat(hasDependency(modulePom(appPom), "org.springdoc", "springdoc-openapi-starter-webmvc-ui"))
.as(appPom + " exposes REST APIs")
.isTrue();
}
}
@Test @Test
void buildSurfaceDoesNotManageLombokWhenProductionSourcesDoNotUseIt() throws Exception { void buildSurfaceDoesNotManageLombokWhenProductionSourcesDoNotUseIt() throws Exception {
Document pom = rootPom(); Document pom = rootPom();

View File

@@ -163,8 +163,9 @@ class PortainerComposeResourceLimitsTest {
.contains("launchctl bootout \"gui/$(id -u)\" \"$HOME/Library/LaunchAgents/com.lingniu.yutong-mqtt.plist\" || true") .contains("launchctl bootout \"gui/$(id -u)\" \"$HOME/Library/LaunchAgents/com.lingniu.yutong-mqtt.plist\" || true")
.contains("launchctl bootout \"gui/$(id -u)\" \"$HOME/Library/LaunchAgents/com.lingniu.vehicle-analytics.plist\" || true") .contains("launchctl bootout \"gui/$(id -u)\" \"$HOME/Library/LaunchAgents/com.lingniu.vehicle-analytics.plist\" || true")
.contains("launchctl list | rg 'com.lingniu.(gb32960|jt808|yutong-mqtt|vehicle-history|vehicle-analytics)'") .contains("launchctl list | rg 'com.lingniu.(gb32960|jt808|yutong-mqtt|vehicle-history|vehicle-analytics)'")
.contains("Yutong MQTT ingest: `http://127.0.0.1:20500/swagger-ui/index.html`") .contains("Yutong MQTT ingest health: `http://127.0.0.1:20500/actuator/health`")
.contains("Analytics metrics: `http://127.0.0.1:20300/swagger-ui/index.html`") .contains("Analytics metrics: `http://127.0.0.1:20300/swagger-ui/index.html`")
.doesNotContain("Yutong MQTT ingest: `http://127.0.0.1:20500/swagger-ui/index.html`")
.doesNotContain("sed \\") .doesNotContain("sed \\")
.doesNotContain("三个服务"); .doesNotContain("三个服务");
@@ -451,7 +452,8 @@ class PortainerComposeResourceLimitsTest {
assertThat(readme) assertThat(readme)
.contains("`jt808-ingest-app`: TCP `808`HTTP `20400`") .contains("`jt808-ingest-app`: TCP `808`HTTP `20400`")
.contains("curl -sS http://127.0.0.1:20400/actuator/health") .contains("curl -sS http://127.0.0.1:20400/actuator/health")
.contains("JT808 ingest: `http://127.0.0.1:20400/swagger-ui/index.html`") .contains("JT808 ingest health: `http://127.0.0.1:20400/actuator/health`")
.doesNotContain("JT808 ingest: `http://127.0.0.1:20400/swagger-ui/index.html`")
.doesNotContain("20482"); .doesNotContain("20482");
} }

View File

@@ -45,10 +45,6 @@
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>

View File

@@ -21,12 +21,6 @@ spring:
server: server:
port: ${HTTP_PORT:20500} port: ${HTTP_PORT:20500}
springdoc:
swagger-ui:
path: /swagger-ui.html
api-docs:
path: /v3/api-docs
lingniu: lingniu:
ingest: ingest:
mqtt: mqtt:

View File

@@ -49,6 +49,7 @@ class YutongMqttAppDefaultsTest {
.doesNotContain("event-file-store:") .doesNotContain("event-file-store:")
.doesNotContain("vehicle-state:") .doesNotContain("vehicle-state:")
.doesNotContain("vehicle-stat:") .doesNotContain("vehicle-stat:")
.doesNotContain("springdoc:")
.doesNotContain("VEHICLE_IDENTITY_STORE") .doesNotContain("VEHICLE_IDENTITY_STORE")
.doesNotContain("KAFKA_ENABLED"); .doesNotContain("KAFKA_ENABLED");
} }