davsclaus commented on code in PR #28046:
URL: https://github.com/apache/camel/pull/28046#discussion_r4306356950
##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/SchemaHints.java:
##########
@@ -129,6 +129,27 @@ static String unquotedBraces(Match m) {
}
/** The text of a scalar property of the error's node, or the fallback
when it is not a scalar. */
Review Comment:
Right, my insertion split the javadoc from `valueOf`. It is back on its
method in 9cdbbf30ea56.
_Claude Code on behalf of davsclaus_
##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/SchemaHints.java:
##########
@@ -129,6 +129,27 @@ static String unquotedBraces(Match m) {
}
/** The text of a scalar property of the error's node, or the fallback
when it is not a scalar. */
+ /** A value that names a script file by its scheme, as resource: loads it.
*/
+ private static final Pattern SCRIPT_FILE =
Pattern.compile("(file|classpath|https?):.+", Pattern.DOTALL);
+
+ /**
+ * Where the text of a language goes, for the text written under another
key (groovy: {script: "..."}). A script
+ * file under resource: (groovy: {resource: "file:x.groovy"}) is loaded
with the resource: prefix, which the value
+ * often lacks (CAMEL-25748): the expression "file:x.groovy" would run as
code.
+ */
+ static String languageTextHint(String language, String property, String
value) {
+ String key = property.toLowerCase(Locale.ROOT);
+ String text = value.strip();
+ boolean scriptFile = !text.startsWith("resource:")
+ && (key.contains("resource") || key.startsWith("script") &&
SCRIPT_FILE.matcher(text).matches());
Review Comment:
Done in 9cdbbf30ea56.
_Claude Code on behalf of davsclaus_
--
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]