gnodet-bot commented on code in PR #26758:
URL: https://github.com/apache/camel/pull/26758#discussion_r4080492807
##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/EipDocExamplesTest.java:
##########
@@ -141,6 +141,9 @@ private static DocExamples validate(List<String> pages)
throws Exception {
if (skipped != null && yaml.contains(skipped)) {
continue;
}
+ if (DocBlocks.markedToSkip(doc, m.start())) {
Review Comment:
⚠️ **Incomplete consolidation — `EipDocExamplesTest` should call
`DocBlocks.examples()`, not inline its own extraction.**
This test (and `CatalogDocExamplesTest`) only borrow `markedToSkip()` from
`DocBlocks` but still maintain their own block-extraction loop. Two concrete
gaps:
1. **No callout stripping** — `DocBlocks.examples()` runs
`CALLOUT.matcher(m.group(1)).replaceAll("")` before returning each YAML block;
these tests just do `m.group(1).stripTrailing()`. If any doc page has an
AsciiDoc callout marker (`# <1>`) inside a YAML block, the plugin produces
clean YAML while the test validates the raw annotated text — different
behaviour from the same source.
2. **Different `YAML_BLOCK` pattern** — `DocBlocks` uses
`\[source,yaml\]\s*\n----\n` (tolerates trailing whitespace after the attribute
list); this test uses `\[source,yaml\]\n-{4}\n` (no `\s*`, so a block preceded
by e.g. `[source,yaml,options=...]` is matched by the plugin but missed by the
test).
The whole point of extracting `DocBlocks` was to have one canonical
implementation. The fix is straightforward: replace the inline `YAML_BLOCK`
loop in `EipDocExamplesTest.validate()` with `DocBlocks.examples(doc)` and
iterate over that. The `EXAMPLES_SKIPPED` guard moves outside: check
`yaml.contains(skipped)` on the already-filtered list. Same treatment for
`CatalogDocExamplesTest`.
##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/CatalogDocExamplesTest.java:
##########
@@ -106,6 +107,10 @@ private static DocExamples validate(List<String> pages) {
if (skipped != null && yaml.contains(skipped)) {
continue;
}
+ if (DocBlocks.markedToSkip(doc, m.start())) {
Review Comment:
Same issue as `EipDocExamplesTest`: this test calls
`DocBlocks.markedToSkip()` but retains its own `YAML_BLOCK` pattern and skips
callout stripping. Replace the `Matcher m = YAML_BLOCK.matcher(doc)` loop with
`DocBlocks.examples(doc)` for consistency with `GenerateDocSamplesMojo`.
--
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]