File tree Expand file tree Collapse file tree 2 files changed +2
-16
lines changed
customer-service-client/src/main/java/com/example/demo/client/adapter/config
customer-service/src/main/java/com/example/demo/common/api/config Expand file tree Collapse file tree 2 files changed +2
-16
lines changed Original file line number Diff line number Diff line change 1- // src/main/java/com/example/demo/client/adapter/config/CustomerApiClientConfig.java
21package com .example .demo .client .adapter .config ;
32
43import com .example .demo .client .generated .api .CustomerControllerApi ;
Original file line number Diff line number Diff line change 1- // src/main/java/com/example/demo/common/api/config/OpenApiConfig.java
21package com .example .demo .common .api .config ;
32
43import io .swagger .v3 .oas .models .OpenAPI ;
@@ -14,18 +13,6 @@ public class OpenApiConfig {
1413 @ Value ("${app.openapi.base-url:}" )
1514 private String baseUrl ;
1615
17- @ Value ("${server.servlet.context-path:/}" )
18- private String contextPath ;
19-
20- private static boolean isBlank (String s ) {
21- return s == null || s .isBlank ();
22- }
23-
24- private static String normalize (String path ) {
25- if (path == null || path .isBlank () || "/" .equals (path )) return "" ;
26- return path .startsWith ("/" ) ? path : "/" + path ;
27- }
28-
2916 @ Bean
3017 public OpenAPI customerServiceOpenAPI () {
3118 var openapi = new OpenAPI ()
@@ -34,9 +21,9 @@ public OpenAPI customerServiceOpenAPI() {
3421 .version ("0.1.0" )
3522 .description ("Demo: type-safe generic API responses with OpenAPI" ));
3623
37- if (! isBlank (baseUrl )) {
24+ if (baseUrl != null && ! baseUrl . isBlank ()) {
3825 openapi .addServersItem (new Server ()
39- .url (baseUrl + normalize ( contextPath ) )
26+ .url (baseUrl )
4027 .description ("Local service URL" ));
4128 }
4229 return openapi ;
You can’t perform that action at this time.
0 commit comments