davsclaus commented on code in PR #26762:
URL: https://github.com/apache/camel/pull/26762#discussion_r4082288876


##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/YamlValidator.java:
##########
@@ -754,11 +757,27 @@ private static String expressionInPath(String uri) {
     }
 
     /**
-     * Components that evaluate their path for each message, where an 
expression in it is what the component is for: the
-     * language component's script, and the metric name of the two metrics 
components. Each was read in the component's
-     * own producer; CAMEL-24918 replaces this list with metadata in the 
catalog, so that a component says it itself.
+     * The one component whose path is a script written in another language, 
so what is in it is not the catalog's to
+     * say: language:simple:Hello ${body} is the script, not an address. 
Everything else is read from the catalog
+     * (CAMEL-24918).
      */
-    private static final Set<String> EVALUATED_PATH = Set.of("language", 
"micrometer", "opentelemetry-metrics");
+    private static final Set<String> SCRIPT_PATH = Set.of("language");
+
+    /**
+     * Whether the component evaluates its path for each message, which its 
catalog metadata says: an expression is then
+     * what the path is for, as in micrometer:counter:orders.${header.region} 
(CAMEL-24918).
+     */
+    private boolean pathTakesAnExpression(String component) {
+        try {
+            ComponentModel model = catalog().componentModel(component);
+            if (model == null) {
+                return true; // a component the catalog does not know: say 
nothing rather than the wrong thing
+            }
+            return 
model.getEndpointPathOptions().stream().anyMatch(BaseOptionModel::isSupportSimpleExpression);
+        } catch (Exception e) {
+            return true;
+        }

Review Comment:
   Fixed: it logs at debug why the check was skipped, with the component name, 
rather than going quiet. The fail-open itself stays - an unknown component 
should not be reported as a mistake.



##########
components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java:
##########
@@ -96,6 +97,7 @@ public abstract class GenericFileEndpoint<T> extends 
ScheduledPollEndpoint imple
                             + "file exists. This option configures what file 
name to use. Either you can specify a fixed name. Or you "
                             + "can use dynamic placeholders.The done file is 
always expected in the same folder as the original "
                             + "file.<p/> Only ${file.name} and 
${file.name.next} is supported as dynamic placeholders.")
+    @Metadata(supportSimpleExpression = true)
     protected String doneFileName;

Review Comment:
   The observation is right - `doneFileName` gains `"deprecationNote": ""` - 
but the cause is not this PR, and the suggested fix is much larger than it 
looks.
   
   Any option carrying `@Metadata` already gets it. `directoryName` on the same 
endpoint has `"deprecationNote": ""` on main today, and across components and 
core there are **11125 of them in 803 files**. So this is the existing 
convention for an annotated option, and `doneFileName` is joining it, not 
breaking new ground.
   
   Guarding the empty in `EndpointSchemaGeneratorMojo` would be the right 
cleanup, and it would rewrite those 11125 entries in one regeneration - a 
catalog-wide diff that has nothing to do with per-message metadata and should 
not ride in on this PR. Happy to file it separately if you think it is worth 
doing.
   
   The alternative - dropping the annotation from `doneFileName` - would lose 
the flag on the one String-typed file option the producer really does evaluate, 
which is the point of the change.



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