Преглед на файлове

doc: pipeline swagger注释修改

370774330@qq.com преди 5 години
родител
ревизия
aaf59068db

+ 5 - 4
web/src/main/java/seecoder/devcloud/web/controller/pipeline/DeploymentController.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
@@ -19,9 +20,9 @@ import java.util.List;
  * @date 2021/3/12
  * @date 2021/3/12
  * @description:
  * @description:
  */
  */
-@RestController("/deployments")
-@ResponseBody
-@Api(value = "流水线部署的实例")
+@Api(tags = "流水线部署的实例 API")
+@RestController
+@RequestMapping("/deployments")
 public class DeploymentController {
 public class DeploymentController {
 
 
     private final DeploymentService deploymentService;
     private final DeploymentService deploymentService;
@@ -53,7 +54,7 @@ public class DeploymentController {
      * 执行一条pipepine
      * 执行一条pipepine
      * todo 异步/异步异常捕获刷新result
      * todo 异步/异步异常捕获刷新result
      */
      */
-    @ApiOperation(value = "删除一个实例", httpMethod = "DELETE")
+    @ApiOperation(value = "删除一个部署的实例", httpMethod = "DELETE")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "projectId", dataType = "int"),
             @ApiImplicitParam(name = "projectId", dataType = "int"),
             @ApiImplicitParam(name = "pipelineId", dataType = "int")
             @ApiImplicitParam(name = "pipelineId", dataType = "int")

+ 4 - 7
web/src/main/java/seecoder/devcloud/web/controller/pipeline/PipelineController.java

@@ -23,9 +23,9 @@ import java.util.List;
  * @date 2021/3/11
  * @date 2021/3/11
  * @description:
  * @description:
  */
  */
-@RestController("/pipelines")
-@ResponseBody
-@Api(value = "流水线配置")
+@RestController
+@RequestMapping("/pipelines")
+@Api(tags = "流水线配置 API")
 public class PipelineController {
 public class PipelineController {
 
 
     private final PipelineService pipelineService;
     private final PipelineService pipelineService;
@@ -35,11 +35,8 @@ public class PipelineController {
         this.pipelineService = pipelineService;
         this.pipelineService = pipelineService;
     }
     }
 
 
-    /**
-     * 获取一个项目所有的流水线信息
-     */
     @GetMapping("/list")
     @GetMapping("/list")
-    @ApiOperation(value = "获取指定一条流水线的配置json信息", httpMethod = "GET")
+    @ApiOperation(value = "获取指定项目的所有流水线基本信息", httpMethod = "GET")
     @ApiImplicitParam(name = "projectId", dataType = "int")
     @ApiImplicitParam(name = "projectId", dataType = "int")
     public Response<List<PipelineInfoVO>> retrievePipelineInfos(@RequestParam("projectId") Integer projectId){
     public Response<List<PipelineInfoVO>> retrievePipelineInfos(@RequestParam("projectId") Integer projectId){
         return Response.buildSuccess(pipelineService.retrievePipelineInfos(projectId));
         return Response.buildSuccess(pipelineService.retrievePipelineInfos(projectId));

+ 3 - 3
web/src/main/java/seecoder/devcloud/web/controller/user/UserController.java

@@ -12,8 +12,8 @@ import seecoder.devcloud.web.service.user.UserService;
  * @date 2021/3/5
  * @date 2021/3/5
  * @description:
  * @description:
  */
  */
-@RestController("/users/")
-@ResponseBody
+@RestController
+@RequestMapping("/users")
 public class UserController {
 public class UserController {
 
 
     private final UserService userService;
     private final UserService userService;
@@ -23,7 +23,7 @@ public class UserController {
         this.userService = userService;
         this.userService = userService;
     }
     }
 
 
-    @GetMapping("/")
+    @GetMapping
     public Response getLoginUser(){
     public Response getLoginUser(){
         return Response.buildSuccess(userService.getLoginUser());
         return Response.buildSuccess(userService.getLoginUser());
     }
     }

+ 5 - 0
web/src/main/java/seecoder/devcloud/web/infrastructure/config/SwaggerConfig.java

@@ -1,5 +1,6 @@
 package seecoder.devcloud.web.infrastructure.config;
 package seecoder.devcloud.web.infrastructure.config;
 
 
+import org.glassfish.jersey.internal.guava.Predicates;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
@@ -8,6 +9,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 import springfox.boot.starter.autoconfigure.SpringfoxConfigurationProperties;
 import springfox.boot.starter.autoconfigure.SpringfoxConfigurationProperties;
 import springfox.documentation.builders.ApiInfoBuilder;
 import springfox.documentation.builders.ApiInfoBuilder;
 import springfox.documentation.builders.PathSelectors;
 import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
 import springfox.documentation.oas.annotations.EnableOpenApi;
 import springfox.documentation.oas.annotations.EnableOpenApi;
 import springfox.documentation.service.ApiInfo;
 import springfox.documentation.service.ApiInfo;
 import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spi.DocumentationType;
@@ -44,6 +46,9 @@ public class SwaggerConfig{
                 .apiInfo(initApiInfo())
                 .apiInfo(initApiInfo())
                 .select()
                 .select()
                 //.paths(doFilteringRules())
                 //.paths(doFilteringRules())
+                //不显示错误的接口地址
+                .apis(RequestHandlerSelectors.basePackage("seecoder.devcloud.web.controller"))
+                .paths(Predicates.not(PathSelectors.regex("/error.*")))
                 .paths(PathSelectors.any())
                 .paths(PathSelectors.any())
                 .build();
                 .build();
 
 

+ 1 - 1
web/src/main/java/seecoder/devcloud/web/model/vo/pipeline/PipelineConfigVO.java

@@ -12,7 +12,7 @@ import seecoder.devcloud.web.model.po.pipeline.Pipeline;
  * @description:
  * @description:
  */
  */
 @Data
 @Data
-@ApiModel("流水线的json配置界面")
+@ApiModel("流水线的json配置信息")
 public class PipelineConfigVO {
 public class PipelineConfigVO {
 
 
     @ApiModelProperty("流水线id")
     @ApiModelProperty("流水线id")

+ 1 - 1
web/src/main/java/seecoder/devcloud/web/model/vo/pipeline/PipelineCreateVO.java

@@ -11,7 +11,7 @@ import javax.validation.Valid;
  * @description:
  * @description:
  */
  */
 @Data
 @Data
-@ApiModel("流水线创建配置信息")
+@ApiModel("流水线创建表单信息")
 public class PipelineCreateVO {
 public class PipelineCreateVO {
 
 
     private Integer projectId;
     private Integer projectId;

+ 1 - 1
web/src/main/java/seecoder/devcloud/web/model/vo/pipeline/PipelineHistoryVO.java

@@ -16,7 +16,7 @@ import java.sql.Timestamp;
  */
  */
 @Data
 @Data
 @NoArgsConstructor
 @NoArgsConstructor
-@ApiModel("流水线的一条历史构建记录")
+@ApiModel("流水线历史构建记录")
 public class PipelineHistoryVO {
 public class PipelineHistoryVO {
 
 
     @ApiModelProperty("流水线构建历史id")
     @ApiModelProperty("流水线构建历史id")

+ 1 - 1
web/src/main/java/seecoder/devcloud/web/model/vo/pipeline/PipelineInfoVO.java

@@ -18,7 +18,7 @@ import java.sql.Timestamp;
  */
  */
 @Data
 @Data
 @Builder
 @Builder
-@ApiModel("一条流水线基本信息")
+@ApiModel("流水线基本信息")
 @AllArgsConstructor
 @AllArgsConstructor
 public class PipelineInfoVO {
 public class PipelineInfoVO {