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: diff --git a/CHANGELOG.md b/CHANGELOG.md index a4a5b50..41b4b2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.2.10 (November 21, 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..b3e2a96 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", "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) {