|
@@ -1,5 +1,6 @@
|
|
|
package com.github.microservice.utils;
|
|
package com.github.microservice.utils;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.github.microservice.models.openAPI.OpenApiInfo;
|
|
import com.github.microservice.models.openAPI.OpenApiInfo;
|
|
@@ -137,6 +138,20 @@ public class OpenAPIScan {
|
|
|
if (jsonObject.containsKey("components")) {
|
|
if (jsonObject.containsKey("components")) {
|
|
|
schemas = jsonObject.getJSONObject("components").getJSONObject("schemas");
|
|
schemas = jsonObject.getJSONObject("components").getJSONObject("schemas");
|
|
|
}
|
|
}
|
|
|
|
|
+ JSONArray tags = new JSONArray();
|
|
|
|
|
+ if (jsonObject.containsKey("tags")) {
|
|
|
|
|
+ JSONArray oldTags = jsonObject.getJSONArray("tags");
|
|
|
|
|
+ for (int i = 0; i < oldTags.size(); i++) {
|
|
|
|
|
+ JSONObject tempObj = oldTags.getJSONObject(i);
|
|
|
|
|
+ if (tempObj.containsKey("name")) {
|
|
|
|
|
+ String name = tempObj.getStr("name");
|
|
|
|
|
+ if (name != null && name.contains(sign)) {
|
|
|
|
|
+ tags.add(tempObj);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ jsonObject.put("tags", tags);
|
|
|
if (jsonObject.containsKey("paths")) {
|
|
if (jsonObject.containsKey("paths")) {
|
|
|
JSONObject paths = jsonObject.getJSONObject("paths");
|
|
JSONObject paths = jsonObject.getJSONObject("paths");
|
|
|
List<String> keys = List.of(paths.keySet().toArray(new String[0]));
|
|
List<String> keys = List.of(paths.keySet().toArray(new String[0]));
|