Claus Ibsen created CAMEL-25182:
-----------------------------------

             Summary: Check the Java DSL examples of the documentation with the 
Java DSL parser
                 Key: CAMEL-25182
                 URL: https://issues.apache.org/jira/browse/CAMEL-25182
             Project: Camel
          Issue Type: Improvement
          Components: documentation
            Reporter: Claus Ibsen


The YAML and XML route examples of the documentation are validated in the 
build, but the Java examples are only import-checked (CAMEL-24774).

The Java DSL parser of CAMEL-25148 (LwJavaParser in camel-java-io) reads Java 
DSL source into the model without compiling it. Running it over the docs: 4182 
Java blocks, 2882 with route DSL, 2150 read completely. Most of the rest is by 
design (lambdas, helper methods, variables). About 60 examples call a DSL 
method that does not exist or with arguments it does not take, for example:

* setBody("Ciao") instead of setBody(constant("Ciao")) (aws2-translate, 
hwcloud, jdbc)
* filter("${header.login} == true") (aws2-sqs), thread(5) (seda, disruptor), 
onException(ValidationException)
* .marshal().univocityCsv() / univocityTsv() / univocityFixed() and 
.marshal().yaml(): the data format clause has no such methods (only the 
dataFormat() builder factory has them)
* doCatch after policy(...) without end(), missing parentheses, removed API 
(exceptionPolicyStrategy, jq with header name, resumable(...).intermittent)

This issue:

* adds a build test that parses the Java examples of the catalog docs and fails 
on calls the Java DSL does not have;
* fixes the documentation examples;
* adds the missing Java DSL convenience methods;
* improves the parser where the examples show a gap (char literals, 
Map.of/List.of, a few JDK constants).

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to