Repository navigation
chore: write the Kamelets in canonical YAML DSL - #3089
Conversation
The templates of 187 of the 262 Kamelets used the compact notation, so Camel logged "YAML DSL compact notation detected" for every one of them on each load and reload: a warning a user cannot act on, about a file inside a jar. Generated with camel validate normalize (apache/camel#27449, CAMEL-25381), which rewrites only spec.template and keeps the rest of each file as written. The Kamelet validator now checks the parameters of from: against the component of its uri (not the first dependency) and accepts prefixed options such as mail.imaps.auth.mechanisms, which the canonical form makes visible to it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
|
I checked the touched YAML files: they all parse, keep everything outside One problem: the comments inside
Could you restore them? And could you check whether |
… as Camel builds the uris Review: the comments inside spec.template were dropped (82 lines in 16 Kamelets). Regenerated with camel validate normalize from apache/camel#27449 as it is now: the comments are back where they were, normalizing a normalized Kamelet changes nothing, azure-storage-files-source is kept as written (an option given two path parts was broken by the uri Camel builds), and the options are in the order Camel builds them with secret options in RAW(), as the YAML DSL wraps them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
|
Thanks @Croway, you're right, and the description was wrong about comments. Fixed in 88bca4c, generated again with apache/camel#27449 as it is now.
Claude Code on behalf of Claus Ibsen |
Claude Code on behalf of Claus Ibsen.
The templates of 187 of the 262 Kamelets use the YAML DSL compact notation, so Camel logs this for each of them on every load and dev-mode reload:
The user (or an AI agent reading the log) is told to fix a file inside a jar they cannot change. This PR writes all 262 templates in the canonical form.
How it was generated
With
camel validate normalize, which can now normalize Kamelet files: apache/camel#27449 (CAMEL-25381, for Camel 4.23.0). It rewrites onlyspec.template, and keeps the license header, metadata, definition, types and dependencies exactly as written. The comments inside the template (82 lines in 16 Kamelets) are put back before the line they were written before. The library copies underlibrary/camel-kamelets/src/main/resources/kameletswere regenerated by the build.What changes in a template:
expression:, for examplesetBody: {expression: {simple: {expression: ...}}}.to:is written asuri:plusparameters:, with options in the order Camel builds them: path options first, then alphabetical.kamelet:endpoint keeps the Kamelet in the uri:uri: kamelet:sink.https://wttr.in/{{?wttrLocation}}?...,azure-storage-blob:{{accountName}}(fewer path parts than its syntax),azure-files:{{accountName}}/{{shareName}}/{{directoryName}}(more path parts than its syntax), andpulsar:{{topicType}}/{{tenant}}/....RAW({{?accessKey}}). Camel's YAML DSL wraps a secret option inRAW()when it builds a uri fromparameters:, so this is what each Kamelet runs with. For a Kamelet that had its secrets in a uri string, such assplunk-source'spassword, that is a change: the value is no longer URL-decoded, which is the safer behaviour.steps:(asplitfollowed by sibling steps) gets its following steps nested inside it, as the YAML DSL already loads it.How it was checked
RAW(), option order. In each, the endpoint options parse to the same values through the Camel catalog, and the same{{placeholders}}are present.splunk-sink,splunk-source):splunk:{{mode}}?…becomessplunk?name={{mode}}&…, with the same options, checked by hand.timer-sourceandlog-sinkrun in a route. The normalizedaws-s3-sinkcreates its endpoint (the bucket name given as a parameter) and stops at AWS credentials, exactly where the original stops../mvnw clean installand./mvnw verifypass. The Citrus integration tests (-Denable.integration.tests) were not run locally; the integration test workflow on this PR runs them.Validator changes (
ValidateKameletsMojo)The canonical form moved some options from the uri string into
parameters:, where the validator reads them. That showed two gaps in the validator:from:against the component of the Kamelet's first dependency. Forazure-storage-blob-changefeed-source,from:is atimerand itstimerNamewas checked againstazure-storage-blob. It now uses the component of thefrom:uri, and falls back to the dependency when that is not a known component.mail.imaps.auth.mechanismsonimaps, which fills the mail properties map. Those are now accepted.Notes for review
nominatim-geocode-action:geocoder:address:toOverridebecomesaddress: address, latlng: toOverride. The catalog's split of that path is odd, but it rebuilds exactly the same uri, so the behaviour is unchanged.camel validate normalize.