Skip to content

Commit

Permalink
fix swagger.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Yinnii committed Aug 5, 2024
1 parent 9e06b6c commit f5a3043
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
1 change: 1 addition & 0 deletions tmitocar-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
package services.tmitocar.config;
import java.util.List;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.servers.Server;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenApiConfig {

Contact c = new Contact().email("https://tech4comp.dbis.rwth-aachen.de/").name("Alexander Tobias Neumann").url("https://tech4comp.dbis.rwth-aachen.de/");

License l = new License().name("ACIS License (BSD3)").url("https://github.com/rwth-acis/las2peer-tmitocar-Service/blob/master/LICENSE");

@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.info(new Info()
.title("tmitocar Service")
.version("3.0.0")
.description("A tmitocar wrapper service for analyzing/evaluating texts.")
.termsOfService("https://tech4comp.de/")
.license(l)
.contact(c)
);
public OpenAPI openAIServiceconfig() {
Server sv = new Server();
sv.setUrl("http://localhost:8080");
sv.setDescription("Development environment URL");
Contact contact = new Contact();
contact.email("[email protected]");
contact.name("Alexander Tobias Neumann, Yue Yin");
License lis = new License().name("ACIS License (BSD3)").url("https://github.com/rwth-acis/las2peer-tmitocar-Service/blob/master/LICENSE");
Info info = new Info()
.title("tmitocar Service")
.version("3.0.0")
.contact(contact)
.description("A tmitocar wrapper service for analyzing/evaluating texts.")
.license(lis)
.termsOfService("https://tech4comp.de/");
return new OpenAPI().info(info).servers(List.of(sv));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class SecurityConfig {
"/v3/api-docs/**",
"/v3/api-docs",
"/swagger.json",
"/tmitocar/swagger.json"
"tmitocar/swagger.json"
};

@Bean
Expand All @@ -48,4 +48,5 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.jwkSetUri(jwkSetUri)
)).build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@

import com.mongodb.client.model.Filters;


import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
import net.minidev.json.parser.JSONParser;
Expand Down Expand Up @@ -83,8 +84,12 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Service
@RequiredArgsConstructor
@Slf4j
public class TmitocarService {
@Value("${publicKey}")
public String publicKey;
Expand Down Expand Up @@ -1065,7 +1070,7 @@ public JSONObject prepareXapiStatement(String user, String verbId, String topic,
public JSONObject getSwagger(){
JSONObject swagger = new JSONObject();
// JSONObject swagger = new JSONObject();
String uri = tmitocarApiDocsUri + "/./tmitocar/v3/api-docs";
String uri = tmitocarApiDocsUri + "/tmitocar/v3/api-docs";
RestTemplate restTemplate = new RestTemplate();
JSONObject result = restTemplate.getForObject(uri, JSONObject.class);

Expand Down

0 comments on commit f5a3043

Please sign in to comment.