From ed0f7fd8f5e95ffcddb76a19aeb7ab2b38263fd3 Mon Sep 17 00:00:00 2001 From: Yinnii Date: Fri, 4 Oct 2024 12:13:30 +0200 Subject: [PATCH] revert swagger changes --- .../service/SocialBotManagerService.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/social-bot-manager/src/main/java/services/socialBotManagerService/service/SocialBotManagerService.java b/social-bot-manager/src/main/java/services/socialBotManagerService/service/SocialBotManagerService.java index 8d7f4585..91460a6d 100644 --- a/social-bot-manager/src/main/java/services/socialBotManagerService/service/SocialBotManagerService.java +++ b/social-bot-manager/src/main/java/services/socialBotManagerService/service/SocialBotManagerService.java @@ -1463,20 +1463,17 @@ public JSONObject getSwagger(){ JSONObject swagger = new JSONObject(); String uri = webconnectorUrl + "/SBFManager/v3/api-docs"; RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.getForObject(uri, String.class); - JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE); - JSONObject resultJson = new JSONObject(); - try { - resultJson = (JSONObject) parser.parse(result); - } catch (ParseException e) { + JSONObject result = restTemplate.getForObject(uri, JSONObject.class); + try{ + swagger.put("swagger", "2.0"); + swagger.put("info", result.get("info")); + swagger.put("basePath", "/SBFManager"); + swagger.put("paths", result.get("paths")); + return swagger; + } catch (Exception e){ e.printStackTrace(); + return null; } - - swagger.put("swagger", "2.0"); - swagger.put("info", resultJson.get("info")); - swagger.put("basePath", "/SBFManager"); - swagger.put("paths", resultJson.get("paths")); - return swagger; } }