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


##########
flink-connector-http/src/main/java/org/apache/flink/connector/http/table/lookup/querycreators/GenericJsonAndUrlQueryCreatorFactory.java:
##########
@@ -152,6 +178,67 @@ public Set<ConfigOption<?>> requiredOptions() {
 
     @Override
     public Set<ConfigOption<?>> optionalOptions() {
-        return Set.of(REQUEST_QUERY_PARAM_FIELDS, REQUEST_BODY_FIELDS, 
REQUEST_URL_MAP);
+        return Set.of(
+                REQUEST_QUERY_PARAM_FIELDS,
+                REQUEST_BODY_FIELDS,
+                REQUEST_URL_MAP,
+                REQUEST_ADDITIONAL_BODY_JSON);
+    }
+
+    /**
+     * Creates and validates the additional JSON node from configuration. This 
method parses the
+     * JSON once during factory creation to avoid re-parsing on every lookup 
request, improving
+     * runtime performance.
+     *
+     * @param requestBodyFields the list of request body field names (join 
keys)
+     * @param additionalRequestJson the additional JSON string to validate and 
parse
+     * @return the parsed ObjectNode, or null if no additional JSON is provided
+     * @throws IllegalArgumentException if the JSON is invalid or contains 
conflicting fields
+     */
+    private ObjectNode createAdditionalObjectNode(
+            List<String> requestBodyFields, String additionalRequestJson) {
+        if (additionalRequestJson == null || 
additionalRequestJson.trim().isEmpty()) {
+            return null;
+        }
+
+        try {
+            // Parse the additional JSON once to avoid re-parsing on every 
lookup
+            ObjectMapper mapper = new ObjectMapper();

Review Comment:
   Minor: for consistency with 
https://github.com/apache/flink-connector-http/pull/17/changes#diff-e73bc96c08ecfe30b58370e4631ac5f6c936ac60dd831475508a9995b8f01f76R165
   
   ```suggestion
               ObjectMapper mapper = ObjectMapperAdapter.instance();
   ```



-- 
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