gnodet-bot commented on code in PR #27841:
URL: https://github.com/apache/camel/pull/27841#discussion_r4294562880
##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/ConfigurationValidateTools.java:
##########
@@ -105,16 +130,62 @@ public ConfigurationValidateResult
camel_configuration_validate(
}
private PropertyValidationInfo toPropertyValidationInfo(
- int lineNumber, String text,
ConfigurationPropertiesValidationResult result) {
- boolean valid = result.isSuccess();
- boolean accepted = result.isAccepted();
- int errors = result.getNumberOfErrors();
- int warnings = result.getNumberOfWarnings();
+ int lineNumber, String text,
ConfigurationPropertiesValidationResult result, boolean isSpringBoot) {
+ boolean checked = result.isAccepted();
+ // A checked line is valid when the catalog found no errors; an
unchecked line
+ // (not recognised as a Camel property) is neither valid nor invalid —
it is simply
+ // not inspected by this catalog.
+ boolean valid = checked && result.isSuccess();
+
+ // For Spring Boot, the catalog uses camel-main metadata which does
not include
+ // starter-specific options (e.g. camel.metrics.uriTagEnabled from
camel-micrometer-starter).
+ // When the only issues are "unknown option" errors AND the key
belongs to a group that is
+ // newly accepted by this fix (not one of the original 10 hardcoded
prefixes), downgrade to
+ // unchecked to avoid false positives — the starter may legitimately
bind options outside the
+ // main schema. Keys under the original 10 groups (component,
dataformat, language, main,
+ // resilience4j, faulttolerance, threadpool, health, lra, rest) retain
full validation since
+ // the catalog has always covered them.
+ boolean springBootDowngraded = false;
+ if (isSpringBoot && checked && !valid) {
+ String propertyKey = text != null && text.contains("=") ?
text.substring(0, text.indexOf('=')).trim() : text;
+ boolean isOriginalGroup = propertyKey != null &&
(propertyKey.startsWith("camel.component.")
+ || propertyKey.startsWith("camel.dataformat.")
+ || propertyKey.startsWith("camel.language.")
+ || propertyKey.startsWith("camel.main.")
+ || propertyKey.startsWith("camel.resilience4j.")
+ || propertyKey.startsWith("camel.faulttolerance.")
+ || propertyKey.startsWith("camel.threadpool.")
+ || propertyKey.startsWith("camel.health.")
+ || propertyKey.startsWith("camel.lra.")
+ || propertyKey.startsWith("camel.rest."));
Review Comment:
⚠️ **Bug: `isOriginalGroup` prefix check doesn't account for Spring Boot
relaxed-binding key format**
`propertyKey` is extracted with no normalization (just `.trim()`), but the
prefix checks use canonical camelCase-free forms (`"camel.faulttolerance."`,
`"camel.threadpool."`). Spring Boot's relaxed-binding convention writes these
as `camel.fault-tolerance.*` and `camel.thread-pool.*` (with dashes), which
will **not** match the dash-free prefix checks — causing them to fall through
to `isOriginalGroup = false`, and then be incorrectly downgraded to unchecked.
Fix: normalize `propertyKey` before the prefix check, the same way the
catalog does:
```suggestion
boolean isOriginalGroup = propertyKey != null &&
(propertyKey.startsWith("camel.component.")
|| propertyKey.startsWith("camel.dataformat.")
|| propertyKey.startsWith("camel.language.")
|| propertyKey.startsWith("camel.main.")
|| propertyKey.startsWith("camel.resilience4j.")
|| propertyKey.startsWith("camel.faulttolerance.")
|| propertyKey.replace("-",
"").startsWith("camel.faulttolerance.")
|| propertyKey.startsWith("camel.threadpool.")
|| propertyKey.replace("-",
"").startsWith("camel.threadpool.")
|| propertyKey.startsWith("camel.health.")
|| propertyKey.startsWith("camel.lra.")
|| propertyKey.startsWith("camel.rest."));
```
Or more robustly, normalize the whole key once upfront:
`propertyKey.replace("-", "").toLowerCase()` and rewrite the prefixes to match.
--
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]