From 17cb9342464ecd8fcf7bd9e712041b0f077a33e6 Mon Sep 17 00:00:00 2001 From: if0s Date: Fri, 15 Nov 2024 15:13:11 +0200 Subject: [PATCH 1/3] $ref fix --- CHANGELOG.md | 3 +++ component.json | 2 +- .../soap/providers/BodyMetaProvider.java | 20 ++++++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4a5b50..db0f834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.2.10 (November 15, 2024) +* Fixed issue when you have `$ref` in generated metadata + # 1.2.9 (April 8, 2022) * Added possibility to handle WSDL files where the "message" doesn't contain an element * Updated the Sailor version to 3.3.9 diff --git a/component.json b/component.json index e614165..75e2239 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "title": "SOAP V2", "service": "request-reply", - "version": "1.2.9", + "version": "1.2.10-dev.3", "description": "Generic SOAP / WebServices integration Component", "docsUrl": "https://docs.elastic.io/components/soap/", "credentials": { diff --git a/src/main/java/io/elastic/soap/providers/BodyMetaProvider.java b/src/main/java/io/elastic/soap/providers/BodyMetaProvider.java index b2883ea..4e769c2 100644 --- a/src/main/java/io/elastic/soap/providers/BodyMetaProvider.java +++ b/src/main/java/io/elastic/soap/providers/BodyMetaProvider.java @@ -25,6 +25,8 @@ import java.util.Map; import javax.json.Json; import javax.json.JsonObject; +import javax.json.JsonObjectBuilder; +import javax.json.JsonValue; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPathExpressionException; @@ -82,6 +84,21 @@ private JsonObject generateSchema(final Message message, final String operationN throw new ComponentException("Could not parse xml, SAXE exception caught", e); } } + public static JsonObject removeRefKeys(JsonObject jsonObject) { + JsonObjectBuilder builder = Json.createObjectBuilder(); + + for (String key : jsonObject.keySet()) { + if (!"$ref".equals(key)) { + JsonValue value = jsonObject.get(key); + if (value instanceof JsonObject) { + value = removeRefKeys((JsonObject) value); + } + builder.add(key, value); + } + } + + return builder.build(); + } @Override public JsonObject getMetaModel(final JsonObject configuration) { @@ -105,8 +122,9 @@ public JsonObject getMetaModel(final JsonObject configuration) { .add("in", in) .add("out", out) .build(); + JsonObject cleanedResult = removeRefKeys(result); LOGGER.info("Successfully generated component metadata"); - return result; + return cleanedResult; } catch (ComponentException e) { throw e; } catch (Exception e) { From 64da1394c135a845870d661fbea861414b2eb9d5 Mon Sep 17 00:00:00 2001 From: if0s Date: Thu, 21 Nov 2024 12:19:52 +0200 Subject: [PATCH 2/3] up --- CHANGELOG.md | 2 +- component.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db0f834..41b4b2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 1.2.10 (November 15, 2024) +# 1.2.10 (November 21, 2024) * Fixed issue when you have `$ref` in generated metadata # 1.2.9 (April 8, 2022) diff --git a/component.json b/component.json index 75e2239..b3e2a96 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "title": "SOAP V2", "service": "request-reply", - "version": "1.2.10-dev.3", + "version": "1.2.10", "description": "Generic SOAP / WebServices integration Component", "docsUrl": "https://docs.elastic.io/components/soap/", "credentials": { From 466bc558ad9e38f1a4da502fb35dbfcbed42de85 Mon Sep 17 00:00:00 2001 From: if0s Date: Thu, 21 Nov 2024 12:24:16 +0200 Subject: [PATCH 3/3] up --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3763c25..b5751ad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,7 +96,7 @@ jobs: - node/install: node-version: << pipeline.parameters.node-version >> - setup_remote_docker: - version: 19.03.13 + version: default docker_layer_caching: true # build and push Docker image - run: