partial migration to new openAPI
This commit is contained in:
parent
fb08b4a4c2
commit
2db58b9e04
|
@ -1,19 +1,19 @@
|
|||
package eu.dnetlib.bioschemas.api;
|
||||
|
||||
import eu.dnetlib.common.app.AbstractDnetApp;
|
||||
import org.springdoc.core.GroupedOpenApi;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import eu.dnetlib.common.app.AbstractDnetApp;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableSwagger2
|
||||
@EnableCaching
|
||||
@EnableScheduling
|
||||
@ComponentScan(basePackages = "eu.dnetlib")
|
||||
|
@ -23,20 +23,20 @@ public class MainApplication extends AbstractDnetApp {
|
|||
SpringApplication.run(MainApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi publicApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("D-Net Bioschemas Service APIs")
|
||||
.pathsToMatch("**/api/**")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configSwagger(final Docket docket) {
|
||||
docket.select()
|
||||
.apis(RequestHandlerSelectors.any())
|
||||
.paths(p -> p.contains("/api/"))
|
||||
.build()
|
||||
.apiInfo(new ApiInfoBuilder()
|
||||
.title("D-Net Bioschemas Service APIs")
|
||||
.description("APIs documentation")
|
||||
.version("1.1")
|
||||
.contact(ApiInfo.DEFAULT_CONTACT)
|
||||
.license("Apache 2.0")
|
||||
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
|
||||
.build());
|
||||
protected void configSwagger(final OpenAPI openApi) {
|
||||
openApi.info(new Info().title("D-Net Bioschemas Service APIs")
|
||||
.description("APIs documentation")
|
||||
.version("1.1")
|
||||
.license(new License().name("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0")));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue