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

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -55,6 +55,7 @@ class Jt808IngestAppDefaultsTest {
.doesNotContain("event-file-store:")
.doesNotContain("vehicle-state:")
.doesNotContain("vehicle-stat:")
.doesNotContain("springdoc:")
.doesNotContain("SESSION_STORE")
.doesNotContain("VEHICLE_IDENTITY_STORE")
.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
void buildSurfaceDoesNotManageLombokWhenProductionSourcesDoNotUseIt() throws Exception {
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.vehicle-analytics.plist\" || true")
.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`")
.doesNotContain("Yutong MQTT ingest: `http://127.0.0.1:20500/swagger-ui/index.html`")
.doesNotContain("sed \\")
.doesNotContain("三个服务");
@@ -451,7 +452,8 @@ class PortainerComposeResourceLimitsTest {
assertThat(readme)
.contains("`jt808-ingest-app`: TCP `808`HTTP `20400`")
.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");
}

View File

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

View File

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

View File

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