From 8022cc509a2c38683babf7e2780f752a027a31d2 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 6 Sep 2021 15:07:09 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20swagger=20=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=BC=83=E7=94=A8=E6=8E=A5=E5=8F=A3=E6=89=93=E4=B8=8ADeleted?= =?UTF-8?q?=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/api/dto/definition/parse/Swagger2Parser.java | 3 +++ .../metersphere/api/dto/definition/parse/Swagger3Parser.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java index 6966755940..f7f302edb8 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java @@ -84,6 +84,9 @@ public class Swagger2Parser extends SwaggerAbstractParser { apiDefinition.setRequest(JSON.toJSONString(request)); apiDefinition.setResponse(JSON.toJSONString(parseResponse(operation, operation.getResponses()))); buildModule(selectModule, apiDefinition, operation.getTags(), selectModulePath); + if (operation.isDeprecated() != null && operation.isDeprecated()) { + apiDefinition.setTags("[\"Deleted\"]"); + } results.add(apiDefinition); } } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java index 7e9db59b33..de782409bc 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java @@ -119,6 +119,9 @@ public class Swagger3Parser extends SwaggerAbstractParser { apiDefinition.setRequest(JSON.toJSONString(request)); apiDefinition.setResponse(JSON.toJSONString(parseResponse(operation.getResponses()))); buildModule(selectModule, apiDefinition, operation.getTags(), selectModulePath); + if (operation.getDeprecated() != null && operation.getDeprecated()) { + apiDefinition.setTags("[\"Deleted\"]"); + } results.add(apiDefinition); } }