Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Re-integrate Swagger with SpringDoc #380

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 2 additions & 20 deletions backend/console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,8 @@
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<exclusions>
<exclusion>
<artifactId>swagger-models</artifactId>
<groupId>io.swagger.core.v3</groupId>
</exclusion>
<exclusion>
<artifactId>swagger-annotations</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
<exclusion>
<artifactId>swagger-annotations</artifactId>
<groupId>io.swagger.core.v3</groupId>
</exclusion>
<exclusion>
<artifactId>swagger-models</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
</exclusions>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,27 @@
*/
package com.alibaba.higress.console.config;

import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;

@Configuration
@EnableOpenApi
public class SwaggerConfig {

@Bean
public Docket docket() {
ApiInfo apiInfo = new ApiInfoBuilder().title("Higress Console")
.contact(new Contact("CH3CHO", "https://github.com/higress-group/higress-console", "[email protected]"))
public GroupedOpenApi openApi() {
Info apiInfo = new Info().title("Higress Console")
.contact(new Contact().name("CH3CHO").url("https://github.com/higress-group/higress-console")
.email("[email protected]"))
.description(
"Higress is a next-generation cloud-native gateway based on Alibaba's internal gateway practices.")
.license("Apache 2.0").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0").build();
return new Docket(DocumentationType.OAS_30).apiInfo(apiInfo).enable(true).select()
.apis(RequestHandlerSelectors.basePackage("com.alibaba.higress.console.controller"))
.paths(PathSelectors.any()).build().pathMapping("/");
.license(new License().name("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0"));
return GroupedOpenApi.builder().group("Higress").displayName("Higress Console")
.addOpenApiCustomiser(openApi -> openApi.info(apiInfo))
.packagesToScan("com.alibaba.higress.console.controller").build();
}
}
20 changes: 10 additions & 10 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<properties>
<java.version>17</java.version>

<springfox.version>3.0.0</springfox.version>
<retrofit.version>2.9.0</retrofit.version>
<guava.version>31.1-jre</guava.version>
<commons-lang3.version>3.13.0</commons-lang3.version>
Expand All @@ -61,7 +60,6 @@
<!-- https://github.com/kubernetes-client/java/wiki/2.-Versioning-and-Compatibility -->
<k8s-client.version>17.0.0</k8s-client.version>
<bouncycastle.version>1.46</bouncycastle.version>
<swagger-parser.version>2.1.21</swagger-parser.version>

<pmd-plugin.version>3.20.0</pmd-plugin.version>
<frontend-plugin.version>1.12.1</frontend-plugin.version>
Expand All @@ -71,6 +69,8 @@
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<central-publishing-maven-plugin.version>0.3.0</central-publishing-maven-plugin.version>
<lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
<swagger-core.version>2.2.20</swagger-core.version>
<springdoc.version>1.8.0</springdoc.version>

<plugin.inputEncoding>${project.build.sourceEncoding}</plugin.inputEncoding>
<plugin.outputEncoding>${project.build.sourceEncoding}</plugin.outputEncoding>
Expand All @@ -83,11 +83,6 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -129,9 +124,14 @@
<version>${retrofit.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
<version>${swagger-parser.version}</version>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>${swagger-core.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
4 changes: 2 additions & 2 deletions backend/sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
</dependency>

<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
Expand Down
Loading