You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2024/03/06 14:57:01 UTC
(camel) branch main updated: CAMEL-20419: Add missing transformer methods to JsonMapper
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 30d2191229a CAMEL-20419: Add missing transformer methods to JsonMapper
30d2191229a is described below
commit 30d2191229a3d39c2c87c9ee79d3f212f1bb7700
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed Mar 6 14:35:57 2024 +0000
CAMEL-20419: Add missing transformer methods to JsonMapper
---
.../java/org/apache/camel/tooling/model/JsonMapper.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java
index 5c87b080c62..7dbd3b3c493 100644
--- a/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java
+++ b/tooling/camel-tooling-model/src/main/java/org/apache/camel/tooling/model/JsonMapper.java
@@ -389,6 +389,23 @@ public final class JsonMapper {
return model;
}
+ public static String createParameterJsonSchema(TransformerModel model) {
+ JsonObject wrapper = asJsonObject(model);
+ return serialize(wrapper);
+ }
+
+ public static JsonObject asJsonObject(TransformerModel model) {
+ JsonObject obj = new JsonObject();
+ baseToJson(model, obj);
+ artifactToJson(model, obj);
+ obj.put("from", model.getFrom());
+ obj.put("to", model.getTo());
+ obj.entrySet().removeIf(e -> e.getValue() == null);
+ JsonObject wrapper = new JsonObject();
+ wrapper.put("transformer", obj);
+ return wrapper;
+ }
+
public static OtherModel generateOtherModel(String json) {
JsonObject obj = deserialize(json);
return generateOtherModel(obj);