Add all-api group for swagger (#2278)

#### What type of PR is this?

/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:

Add all-api group for swagger. Related to https://github.com/halo-dev/halo/pull/2273.

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/2279/head
John Niang 2022-07-27 18:46:13 +08:00 committed by GitHub
parent 5eec9da2e6
commit fdbb513cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 8 deletions

View File

@ -30,8 +30,8 @@ public class SwaggerConfig {
@Bean @Bean
GroupedOpenApi extensionCoreApi() { GroupedOpenApi extensionCoreApi() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
.group("CoreAPI") .group("core-api")
.displayName("Core API") .displayName("Core APIs")
.pathsToMatch("/api/**") .pathsToMatch("/api/**")
.build(); .build();
} }
@ -39,8 +39,8 @@ public class SwaggerConfig {
@Bean @Bean
GroupedOpenApi extensionApi() { GroupedOpenApi extensionApi() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
.group("ExtensionAPI") .group("extension-api")
.displayName("Extension API") .displayName("Extension APIs")
.pathsToMatch("/apis/**") .pathsToMatch("/apis/**")
.pathsToExclude("/apis/api.halo.run/**", "/apis/plugin.api.halo.run/**") .pathsToExclude("/apis/api.halo.run/**", "/apis/plugin.api.halo.run/**")
.build(); .build();
@ -49,8 +49,8 @@ public class SwaggerConfig {
@Bean @Bean
GroupedOpenApi systemCustomApi() { GroupedOpenApi systemCustomApi() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
.group("SystemCustomAPI") .group("core-custom-api")
.displayName("System Custom API") .displayName("Custom APIs in Core")
.pathsToMatch("/apis/api.halo.run/**") .pathsToMatch("/apis/api.halo.run/**")
.build(); .build();
} }
@ -58,10 +58,19 @@ public class SwaggerConfig {
@Bean @Bean
GroupedOpenApi pluginCustomApi() { GroupedOpenApi pluginCustomApi() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
.group("PluginCustomAPI") .group("plugin-custom-api")
.displayName("Plugin Custom API") .displayName("Custom APIs in Plugin")
.pathsToMatch("/apis/plugin.api.halo.run/**") .pathsToMatch("/apis/plugin.api.halo.run/**")
.build(); .build();
} }
@Bean
GroupedOpenApi allApi() {
return GroupedOpenApi.builder()
.group("all-api")
.displayName("All APIs")
.pathsToMatch("/api/**", "/apis/**")
.build();
}
} }