gnodet-bot commented on code in PR #30986:
URL: https://github.com/apache/camel/pull/30986#discussion_r4723749504


##########
components/camel-jsonata/src/main/java/org/apache/camel/component/jsonata/JsonataConstants.java:
##########
@@ -29,6 +29,10 @@ public final class JsonataConstants {
               javaType = "String")
     public static final String JSONATA_RESOURCE_URI = 
"CamelJsonataResourceUri";
 
+    /**
+     * @deprecated not used: the producer does not read this header.
+     */
+    @Deprecated(since = "4.24.0")

Review Comment:
   💡 **Nit:** `JSONATA_CONTEXT` has `@Deprecated` but no `@Metadata` 
annotation. `JSONATA_RESOURCE_URI` above it carries `@Metadata(description=..., 
javaType=...)` for catalog generation. A `@Metadata(deprecationNote=...)` here 
would surface the deprecation reason in the catalog the same way 
`allowContextMapAll` does in `JsonataEndpoint`.
   
   ```suggestion
       @Metadata(description = "Not used by the producer. Deprecated: the 
producer never read this header.",
                 javaType = "Object",
                 deprecationNote = "The producer never read this header; 
setting it has no effect.")
       @Deprecated(since = "4.24.0")
       public static final String JSONATA_CONTEXT = "CamelJsonataContext";
   ```



##########
components/camel-jsonata/src/test/java/org/apache/camel/component/jsonata/JsonataExpressionResourceTest.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jsonata;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.camel.CatalogCamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+import tools.jackson.databind.JsonNode;
+import tools.jackson.databind.json.JsonMapper;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * When the producer opens the resource of the endpoint, and the 
allowContextMapAll option that jsonata does not use.

Review Comment:
   💡 **Nit:** The class-level Javadoc is an unfinished sentence. `"When the 
producer opens the resource of the endpoint, and the allowContextMapAll option 
that jsonata does not use."` — the clause after `"and"` doesn't complete a 
thought. It reads as if a second sentence was cut off mid-draft. Suggest a 
rewrite:
   
   ```suggestion
    * Tests for two fixes: the endpoint resource is opened only after the 
header expression check,
    * and the deprecated {@code allowContextMapAll} option that jsonata never 
uses.
   ```



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -693,6 +693,15 @@ Before, its lock failed with an `OptimisticLockException`, 
and the poll was roll
 
 Other JPA providers, and the optimistic lock modes, are not affected.
 
+=== camel-jsonata - allowContextMapAll and CamelJsonataContext are deprecated

Review Comment:
   💡 **Nit:** The upgrade guide entry covers only the two deprecations. The 
behavioral fix — that the endpoint resource is now opened *after* the header 
check, so an `allowTemplateFromHeader=true` exchange no longer fails when the 
endpoint URI points to a missing/non-existent resource — is also a user-visible 
change. Users who relied on the endpoint URI always being validated (even when 
the header overrides it) will see different behaviour. Consider adding a 
sentence:
   
   > The order of operations in `JsonataEndpoint.onExchange()` was changed: the 
endpoint resource is now opened only when the `CamelJsonataResourceUri` header 
does not replace it. As a side effect, an `allowTemplateFromHeader=true` 
endpoint whose URI points to a missing resource no longer fails the exchange 
when the header is set.



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