Skip to content

Commit c80b7c3

Browse files
committed
Replace generated server URL in Swagger UI
The generated server URL uses HTTP regardless of the protocol used to view Swagger UI. HTTP requests to CF will fail with the message TypeError: NetworkError when attempting to fetch resource.
1 parent 901b031 commit c80b7c3

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@
199199
<artifactId>micrometer-registry-prometheus</artifactId>
200200
<scope>runtime</scope>
201201
</dependency>
202+
<dependency>
203+
<groupId>io.swagger.core.v3</groupId>
204+
<artifactId>swagger-core</artifactId>
205+
<version>2.2.20</version>
206+
</dependency>
202207
</dependencies>
203208
<build>
204209
<!-- read properties from the pom file and add them to the application.properties -->

src/main/java/org/phoebus/channelfinder/Application.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.util.logging.Level;
2121
import java.util.logging.Logger;
2222

23+
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
24+
import io.swagger.v3.oas.annotations.servers.Server;
2325
import org.phoebus.channelfinder.example.PopulateService;
2426
import org.phoebus.channelfinder.processors.ChannelProcessor;
2527
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,6 +40,11 @@
3840
@EnableAutoConfiguration
3941
@ComponentScan(basePackages="org.phoebus.channelfinder")
4042
@EnableScheduling
43+
@OpenAPIDefinition(
44+
servers = {
45+
@Server(url = "/")
46+
}
47+
)
4148
@SpringBootApplication
4249
public class Application implements ApplicationRunner {
4350

0 commit comments

Comments
 (0)