davsclaus opened a new pull request, #26488: URL: https://github.com/apache/camel/pull/26488
`camel validate yaml` and `camel validate source` checked a file against the CLI's own catalog and YAML DSL schema, whatever version the project runs. They now take `--camel-version` and `--runtime` like `camel catalog` and `camel doc`, and `camel_validate_source` answers for its `camelVersion` on both halves — noted while reviewing PR 26378: the catalog half alone would have made `--camel-version` misleading. **What changed** - `YamlValidator(boolean canonical, String schemaJson, CamelCatalog catalog)`: a validator for a schema document handed to it (and the catalog of that version for the canonical one-of check); the existing constructors keep the classpath schema. - `CatalogLoader.loadYamlDslSchema(repos, version, canonical, download)`: reads `schema/camelYamlDsl[-canonical].json` from `org.apache.camel:camel-yaml-dsl:<version>` through the Maven downloader; null for the CLI's own version (nothing to download). Every 4.x jar ships the classic schema; the canonical one exists from 4.22 (CAMEL-22987), so `--canonical` with an older version is an error, not a silent fallback. - `SourceValidator` keys its schema validator on the version of the catalog it is given (`getCatalogVersion()` of a catalog `CatalogLoader.loadCatalog` downloaded), one per version. That covers `camel_validate_source` with `camelVersion`, `camel_write_file`, and the TUI, which already sets the selected integration's version on the `ToolContext` — no call site changed. A `validate(..., YamlValidator)` overload takes an explicit validator for the runtime catalogs, whose version the catalog does not report. - `CatalogVersionMixin` in the validate plugin: `--camel-version`, `--runtime`, `MavenResolverMixin` (`--repos`, `--download`, `--fresh`) and `QuarkusPlatformMixin` (`--quarkus-version`, registry); `main` loads the plain catalog, `spring-boot` the Spring Boot catalog, `quarkus` the platform resolved from the Camel version (or `--quarkus-version`) and its `camel-quarkus-catalog`; the schema is read for the Camel version the platform pins. - `EndpointChecks`: a component the runtime catalog does not have while Camel has it is an error (`kafka: Camel Quarkus has no extension for this component (no camel-quarkus-kafka)`, or the Spring Boot starter). The plain catalog keeps saying nothing about an unknown scheme: a project can register a component of its own. **Not version-aware, said in the docs**: Simple expressions are parsed by the CLI's own Simple language (the other version's catalog supplies the function list); the Java, XSLT and XML checks of `camel validate source` use the CLI's classpath. **Local model / tool cost**: no tool schema changed; `camelVersion` stays optional and the default path stays offline. The TUI core prompt budget is untouched. **Tests**: `YamlValidatorSchemaDocumentTest` (the given document is the schema), `SourceValidatorVersionTest` (a fake Quarkus provider that knows timer and log only; the 4.18.0 catalog gets the 4.18.0 schema, one validator per version; canonical before 4.22 errors), `ValidateCamelVersionTest` in the validate plugin (own version offline; `--camel-version=4.18.0`; `--runtime=quarkus --quarkus-version=3.30.1` reports `atmosphere-websocket`). The tests that download another version are `@DisabledIfSystemProperty(ci.env.name)` like the existing catalog download tests. Module suites: camel-yaml-dsl-validator 98, camel-jbang-core AI 149, the MCP authoring/transform and TUI budget tests all green. **Docs**: the validate plugin section of `camel-jbang-devtools.adoc` (new "Validating against another Camel version or runtime"), the `camel_validate_source` row of the MCP page. No upgrade-guide entry: additive. _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]
