Skip to content

Fix camel validate normalize command#23390

Merged
davsclaus merged 2 commits into
mainfrom
fix-yaml-normalize-command
May 21, 2026
Merged

Fix camel validate normalize command#23390
davsclaus merged 2 commits into
mainfrom
fix-yaml-normalize-command

Conversation

@davsclaus
Copy link
Copy Markdown
Contributor

Summary

Claude Code on behalf of Claus Ibsen

Fix the camel validate normalize command which was non-functional due to two bugs:

  • .camel.yaml files silently skipped: FileUtil.onlyExt(name) returns camel.yaml for double extensions — changed to FileUtil.onlyExt(name, true) (single-extension mode) to correctly return yaml. Same fix applied to YamlValidateCommand.
  • Route reification failures: The command used a lightweight CamelContext that couldn't resolve EIP implementations (CircuitBreaker needs resilience4j, etc.). Rewrote to delegate to the Run command with camel.main.dumpRoutes=yaml, following the same proven pattern used by TransformRoute.
  • URI parameters as expanded key/values: Set dumpRoutesUriAsParameters=true so the canonical output uses expanded parameters: blocks instead of inlining parameters as query strings.

Test plan

  • Build: mvn install -pl dsl/camel-jbang/camel-jbang-plugin-validate -am -DskipTests -q
  • Test simple file: camel validate normalize timer-log.camel.yaml — produces canonical YAML with expanded parameters
  • Test complex file (CircuitBreaker): camel validate normalize route.camel.yaml — no longer fails on missing EIP implementations
  • Normalize 23 example files in camel-jbang-examples successfully

🤖 Generated with Claude Code

davsclaus and others added 2 commits May 20, 2026 22:20
The normalize command had two bugs making it non-functional:

1. Files with .camel.yaml extension were silently skipped because
   matchFile() used FileUtil.onlyExt(name) which returns "camel.yaml"
   for double extensions. Fixed by using onlyExt(name, true) for
   single-extension mode, consistent with other JBang commands.
   Same fix applied to YamlValidateCommand.

2. Route reification failed for complex EIPs (CircuitBreaker, etc.)
   because the lightweight CamelContext lacked required implementations.
   Rewrote to delegate to the Run command with dumpRoutes=yaml, the
   same proven pattern used by TransformRoute.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The canonical YAML DSL format should use expanded parameters as key/value
pairs rather than inlining them as query strings in the URI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions github-actions Bot added the dsl label May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-plugin-validate

POM dependency changes: targeted tests included

Modules affected by dependency changes (1)
  • :camel-jbang-plugin-validate
All tested modules (2 modules)
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher :: Container

⚙️ View full build and test results

@davsclaus davsclaus merged commit de6f726 into main May 21, 2026
6 checks passed
@davsclaus davsclaus deleted the fix-yaml-normalize-command branch May 21, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants