davidradl commented on code in PR #17:
URL: 
https://github.com/apache/flink-connector-http/pull/17#discussion_r2781470248


##########
flink-connector-http/src/main/java/org/apache/flink/connector/http/table/lookup/querycreators/GenericJsonAndUrlQueryCreator.java:
##########
@@ -145,9 +149,36 @@ public LookupQueryInfo createLookupQuery(final RowData 
lookupDataRow) {
             // Body-based queries
             // serialize to a string for the body.
             try {
-                lookupQuery =
-                        ObjectMapperAdapter.instance()
-                                
.writeValueAsString(jsonObject.retain(requestBodyFields));
+                ObjectNode bodyJsonObject = 
jsonObject.retain(requestBodyFields);
+
+                // Merge additional JSON if provided
+                if (additionalRequestJson != null && 
!additionalRequestJson.trim().isEmpty()) {
+                    try {
+                        JsonNode additionalNode =
+                                
ObjectMapperAdapter.instance().readTree(additionalRequestJson);
+                        if (additionalNode.isObject()) {
+                            ObjectNode additionalObjectNode = (ObjectNode) 
additionalNode;
+                            // Merge all fields from additional JSON into the 
body
+                            // This preserves nested objects and arrays as-is
+                            additionalObjectNode
+                                    .fields()
+                                    .forEachRemaining(
+                                            entry ->
+                                                    bodyJsonObject.set(
+                                                            entry.getKey(), 
entry.getValue()));

Review Comment:
   hm - good point. I am thinking that on the whole we would not want to 
overwrite an existing key - because it is a lookup key - that is supposed to 
change on a per request basis so it targets different enrichment content per 
request. I propose I validate that the keys in the additional json to ensure 
they do not match join keys. 
   WDYT?    



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to