Skip to content

Commit

Permalink
Merge pull request #8 from WSE-research/fixSwaggerUI
Browse files Browse the repository at this point in the history
Fix swagger UI
  • Loading branch information
dschiese authored Aug 25, 2023
2 parents be0a134 + 2a8cb4a commit d16fa03
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,6 @@ explanation:hasExplanationForCreatedData rdfs:subPropertyOf explanation:hasExpl
]
----
====
=== Spring Doc & Swagger UI
Swagger UI is available at http://localhost:40190/swagger-ui/index.html
API Docs are available at http://localhost:40190/api-docs
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.wse</groupId>
<artifactId>qanary-explanation-service</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<name>Qanary explanation service</name>
<description>Webservice for rule-based explanation of QA-Systems as well as specific components</description>
<properties>
Expand All @@ -27,8 +27,8 @@
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.7.0</version>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>eu.wdaqua.qanary</groupId>
Expand Down Expand Up @@ -107,6 +107,16 @@
<artifactId>docker-client</artifactId>
<version>8.16.0</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-buildpack-platform</artifactId>
<version>3.1.2</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
package com.wse.qanaryexplanationservice;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

@SpringBootApplication
public class QanaryExplanationServiceApplication {

private Environment env;

public QanaryExplanationServiceApplication(@Autowired Environment env) {
this.env = env;
}

public static void main(String[] args) {
SpringApplication.run(QanaryExplanationServiceApplication.class, args);
}



@Bean
public OpenAPI customOpenAPI(
@Value("${springdoc.version}") String appVersion, //
@Value("${spring.application.name}") String appName //
) {
return new OpenAPI().info(new Info()
.title(appName) //
.version(appVersion) //
.description(
"OpenAPI 3 with Spring Boot provided this API documentation.")
.termsOfService("http://swagger.io/terms/") //
.license(new License().name("Apache 2.0").url("http://springdoc.org")) //
);
}
}
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
spring.application.name=Qanary explanation service
server.port=4000
sparqlEndpoint=http://demos.swe.htwk-leipzig.de:40111/sparql
# swagger-ui custom path
springdoc.swagger-ui.path=/swagger-ui.html
# api-docs custom path
springdoc.api-docs.path=/api-docs
springdoc.version=2.1.0

0 comments on commit d16fa03

Please sign in to comment.