davsclaus commented on code in PR #26639:
URL: https://github.com/apache/camel/pull/26639#discussion_r4058116440
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/PropertiesChecks.java:
##########
@@ -46,6 +47,52 @@ public static List<String> validateProperties(
return validatePropertiesLines(content, line ->
validatePropertyLine(line, catalog, extraPropertyLine));
}
+ /** camel.<group>.<rest>=: the option groups of the main model
(resilience4j, faulttolerance, threadpool...). */
+ static final Pattern GROUP_KEY_PATTERN =
Pattern.compile("^\\s*camel\\.([a-zA-Z0-9-]+)\\.([^=\\s]+)\\s*=");
+
+ /** The camel.* prefixes whose keys legitimately nest, or that other
checks own. */
+ private static final Set<String> NESTING_GROUPS = Set.of("component",
"dataformat", "language", "beans", "variable",
+ "kamelet", "jbang", "route-template", "routeTemplate", "main",
"rest", "server", "management");
+
+ /**
+ *
camel.resilience4j.circuitbreaker.supplierCircuitBreaker.slidingWindowSize=4,
an invented per-id form: the
+ * catalog accepts it and the run dies at startup ("Cannot find getter
method: supplierCircuitBreaker on bean: class
+ * java.lang.String"). The options of a group are global, one segment
after the group; resilience4j is also set per
+ * circuit breaker in the route (CAMEL-24856).
+ */
+ static String nestedGroupKeyHint(String line, CamelCatalog catalog) {
+ Matcher m = GROUP_KEY_PATTERN.matcher(line);
+ if (!m.find()) {
+ return null;
+ }
+ String group = m.group(1);
+ String rest = m.group(2);
+ if (!rest.contains(".") || rest.contains("[") ||
NESTING_GROUPS.contains(group)) {
+ return null;
+ }
+ String prefix = "camel." + group + ".";
+ List<String> options = new ArrayList<>();
+ for (var o : catalog.mainModel().getOptions()) {
Review Comment:
Guarded as suggested in the follow-up commit: `nestedGroupKeyHint` returns
`null` when `catalog.mainModel()` is `null`, so the key just goes to the
catalog as before.
_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]