davsclaus opened a new pull request, #26494: URL: https://github.com/apache/camel/pull/26494
Part of [CAMEL-24710](https://issues.apache.org/jira/browse/CAMEL-24710). The four page families already validate against the **schema** in the build (PRs #26392, #26397, #26398, #26448 and `EipDocExamplesTest`). This PR does the second half the ticket measured: the **catalog checks** (`camel validate yaml` and the authoring tools after the schema — endpoint options, Simple, headers), and puts a build guard behind them. Re-measured on `main` before this PR: 1,820 YAML route examples, **87** failing the catalog checks on 28 pages. After: **0** outside the pages skipped for the metadata mismatches of CAMEL-24748. ## The guard `CatalogDocExamplesTest` in camel-jbang-core (where `SourceValidator` lives), a sibling of `EipDocExamplesTest`: every YAML route example of every page in the catalog runs through `SourceValidator.validateCamelYaml`. Skipped, each with its reason in the table: the 12 pages whose examples are right for the runtime but fail because the metadata disagrees with the component (CAMEL-24748, see below), plus two examples that show what only the runtime knows (a custom simple function, a custom YAML step). A second test fails when a skipped page disappears so the list cannot go stale. ## Checker false positives fixed (~35 examples) `EndpointChecks` / `YamlLines`: - a comment after a value (`asyncTimeout: 30000 # the default is 300000`) was read as part of the value; - the body of a block scalar (`argSchema: |` followed by JSON) was read as options `"type"`, `"properties"`…; - a `Map` option written as a nested map (`headers:` / `tags:` with keys under it) was read as top-level options — the keys are now emitted as `option.key`. `HeaderChecks`: - a dotted name stopped at the dot (`CamelBox.fileName` → `CamelBox`); a name is now looked up as is, by a prefix the component documents with a trailing dot (`CamelSolrField.` for `CamelSolrField.id`), or as the head of an OGNL path (`CamelFileName.length()`); - `name:` counted as a header anywhere — under `setProperty` (`CamelAwsSqsDeleteFiltered`, `CamelHwCloudObs*`) it is a property; it now counts only under `setHeader`/`removeHeader`. `AbstractCamelCatalog.validateEndpointProperties` (camel-core-catalog): `userMetadata.messageId=x` on a `Map` option is Camel's property-binding syntax for a map entry and is now accepted (the option before the dot must be a `Map`); test in `CamelCatalogTest`. ## Metadata the examples rely on (3 components) - camel-crypto: `CamelDigitalSignature` had no `@Metadata`, so the header the sign/verify example reads was unknown. - camel-solr: the `CamelSolrField.` and `CamelSolrParam.` prefixes are now declared as prefix headers. - camel-box: `headersClass` and the `CamelBox.` prefix header the API examples use. Generated JSON and the camel-catalog mirror regenerated. ## Doc examples corrected (4 pages) - `xmlSecurity-dataformat`: the cipher algorithms as the constant names the model lists (`AES_128`, `RSA_v1dot5`), which the data format accepts since CAMEL-24716; the page is no longer skipped in `EipDocExamplesTest`; the Java tab used `XMLCipher.AES_128_CBC`, which does not exist. - `metrics-component`: `metrics:simple.meter` → `metrics:meter:simple.meter` in the section that documents `metrics:meter:metricname`. - `fop-component`: `fop:pdf` (both the name and the MIME type work at runtime; the page now says so). - `openai-component`: the user-chosen response header names drop the `Camel` prefix, which is reserved for Camel's own headers. ## Reported to CAMEL-24748 rather than bent in the docs Five more metadata-vs-runtime mismatches the measurement found, same family as the seven there: olingo2/olingo4 (`syntax = apiName/methodName` while the runtime reads `methodName/resourcePath` with the api name implicit), xmpp (`port` required in the metadata, defaulted at runtime, and a `user@` host prefix), huggingface (`task` enum while the runtime takes any name with `predictorBean`), salesforce `approval.*` (no `@UriParam`), jt400 (the syntax's literal `QSYS.LIB` / `objectPath.type` segments). Their pages are in the guard's skip list with the reason. ## Tests - camel-jbang-core: `CatalogDocExamplesTest` (new), `SourceValidatorEndpointTest` (+2), `SourceValidator*Test`, `ChecksCatalogDriftTest`, `ExampleRoutesLoadTest` — 123, green. - camel-catalog `CamelCatalogTest` (+1) — 126, green. camel-yaml-dsl-validator `EipDocExamplesTest` — green with xmlSecurity unskipped. No upgrade-guide entry: no user-facing behaviour changes beyond the validator accepting more of what the runtime accepts. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
