[monitor-scheduler] 规范优化swagger信息
This commit is contained in:
@@ -58,12 +58,6 @@
|
|||||||
<artifactId>concurrentlinkedhashmap-lru</artifactId>
|
<artifactId>concurrentlinkedhashmap-lru</artifactId>
|
||||||
<version>1.4.2</version>
|
<version>1.4.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 工具依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.usthe.tancloud</groupId>
|
|
||||||
<artifactId>common</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import springfox.documentation.builders.PathSelectors;
|
|||||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
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.service.Contact;
|
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
|
||||||
@@ -27,20 +26,20 @@ public class SwaggerConfig {
|
|||||||
return new Docket(DocumentationType.OAS_30)
|
return new Docket(DocumentationType.OAS_30)
|
||||||
.apiInfo(apiInfo())
|
.apiInfo(apiInfo())
|
||||||
.enable(true)
|
.enable(true)
|
||||||
.groupName("usthe.com")
|
.groupName("TanCloud")
|
||||||
.select()
|
.select()
|
||||||
.apis(RequestHandlerSelectors.any())
|
.apis(RequestHandlerSelectors.any())
|
||||||
.paths(PathSelectors.any())
|
.paths(PathSelectors.regex("(?!/error.*).*"))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiInfo apiInfo(){
|
private ApiInfo apiInfo(){
|
||||||
return new ApiInfo(
|
return new ApiInfo(
|
||||||
"usthe api",
|
"TanCloud",
|
||||||
"monitor project",
|
null,
|
||||||
"v1.0",
|
"v1.0",
|
||||||
"usthe.com",
|
null,
|
||||||
new Contact("tom", "usthe.com", "tomsun28@outlook.com"),
|
null,
|
||||||
"Apache 2.0",
|
"Apache 2.0",
|
||||||
"http://www.apache.org/licenses/LICENSE-2.0",
|
"http://www.apache.org/licenses/LICENSE-2.0",
|
||||||
Collections.emptyList());
|
Collections.emptyList());
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.usthe.manager.pojo.entity.ParamDefine;
|
|||||||
import com.usthe.manager.service.AppService;
|
import com.usthe.manager.service.AppService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -31,7 +32,8 @@ public class AppController {
|
|||||||
|
|
||||||
@GetMapping(path = "/{app}/params")
|
@GetMapping(path = "/{app}/params")
|
||||||
@ApiOperation(value = "查询监控类型的参数结构", notes = "根据app查询指定监控类型的需要输入参数的结构")
|
@ApiOperation(value = "查询监控类型的参数结构", notes = "根据app查询指定监控类型的需要输入参数的结构")
|
||||||
public ResponseEntity<Message<List<ParamDefine>>> queryAppParamDefines(@PathVariable("app") String app) {
|
public ResponseEntity<Message<List<ParamDefine>>> queryAppParamDefines(
|
||||||
|
@ApiParam(value = "监控类型名称", example = "api") @PathVariable("app") String app) {
|
||||||
List<ParamDefine> paramDefines = appService.getAppParamDefines(app);
|
List<ParamDefine> paramDefines = appService.getAppParamDefines(app);
|
||||||
return ResponseEntity.ok(new Message<>(paramDefines));
|
return ResponseEntity.ok(new Message<>(paramDefines));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.usthe.manager.pojo.dto.MonitorDto;
|
|||||||
import com.usthe.manager.service.MonitorService;
|
import com.usthe.manager.service.MonitorService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
@@ -62,7 +63,8 @@ public class MonitorController {
|
|||||||
|
|
||||||
@GetMapping(path = "/{id}")
|
@GetMapping(path = "/{id}")
|
||||||
@ApiOperation(value = "查询监控", notes = "根据监控ID获取监控信息")
|
@ApiOperation(value = "查询监控", notes = "根据监控ID获取监控信息")
|
||||||
public ResponseEntity<Message<MonitorDto>> getMonitor(@PathVariable("id") long id) {
|
public ResponseEntity<Message<MonitorDto>> getMonitor(
|
||||||
|
@ApiParam(value = "监控ID", example = "6565463543") @PathVariable("id") long id) {
|
||||||
// 获取监控信息
|
// 获取监控信息
|
||||||
MonitorDto monitorDto = monitorService.getMonitor(id);
|
MonitorDto monitorDto = monitorService.getMonitor(id);
|
||||||
Message.MessageBuilder<MonitorDto> messageBuilder = Message.builder();
|
Message.MessageBuilder<MonitorDto> messageBuilder = Message.builder();
|
||||||
@@ -76,7 +78,8 @@ public class MonitorController {
|
|||||||
|
|
||||||
@DeleteMapping(path = "/{id}")
|
@DeleteMapping(path = "/{id}")
|
||||||
@ApiOperation(value = "删除监控", notes = "根据监控ID删除监控应用,监控不存在也是删除成功")
|
@ApiOperation(value = "删除监控", notes = "根据监控ID删除监控应用,监控不存在也是删除成功")
|
||||||
public ResponseEntity<Message<Void>> deleteMonitor(@PathVariable("id") long id) {
|
public ResponseEntity<Message<Void>> deleteMonitor(
|
||||||
|
@ApiParam(value = "监控ID", example = "6565463543") @PathVariable("id") long id) {
|
||||||
// 删除监控,监控不存在或删除成功都返回成功
|
// 删除监控,监控不存在或删除成功都返回成功
|
||||||
monitorService.deleteMonitor(id);
|
monitorService.deleteMonitor(id);
|
||||||
return ResponseEntity.ok(new Message<>("Delete success"));
|
return ResponseEntity.ok(new Message<>("Delete success"));
|
||||||
|
|||||||
Reference in New Issue
Block a user