davsclaus opened a new pull request, #3089:
URL: https://github.com/apache/camel-kamelets/pull/3089

   _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:
   
   ```
   WARN YAML DSL compact notation detected in: 
classpath:kamelets/timer-source.kamelet.yaml. ... Use Camel CLI to normalize: 
camel validate normalize <file>
   ```
   
   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 **only 
`spec.template`**, and keeps the license header, metadata, definition, types, 
dependencies and comments exactly as written. The library copies under 
`library/camel-kamelets/src/main/resources/kamelets` were regenerated by the 
build.
   
   What changes in a template:
   - **EIPs:** expressions under `expression:`, for example `setBody: 
{expression: {simple: {expression: ...}}}`.
   - **Endpoints:**
     - `to:` is written as `uri:` plus `parameters:`, with options in the 
catalog's order: path options first, then alphabetical, as Camel builds them.
     - A `kamelet:` endpoint keeps the Kamelet in the uri: `uri: kamelet:sink`.
     - A uri that cannot be split without changing its meaning is kept as 
written. Examples: `https://wttr.in/{{?wttrLocation}}?...`, 
`azure-storage-blob:{{accountName}}` (fewer path parts than its syntax), and 
`pulsar:{{topicType}}/{{tenant}}/...`.
   - **Secret options** show as `RAW({{?accessKey}})`. This is not new 
behaviour: Camel's YAML DSL already wraps secret options in `RAW()` when it 
builds a uri from `parameters:`. Kamelets written with `parameters:` have 
always run that way; the canonical form makes it visible.
   - **A step without `steps:`** (a `split` followed by sibling steps) gets its 
following steps nested inside it, as the YAML DSL already loads it.
   
   ### How it was checked
   
   - **Same route templates.** Each original and normalized Kamelet was loaded 
into Camel and its route template dumped:
     - **97** are byte-identical.
     - **163** differ only in how endpoint uris are written: path options as 
parameters, `RAW()`, option order. In each, the endpoint options parse to the 
same values through the Camel catalog, and the same `{{placeholders}}` are 
present.
     - **2** (`splunk-sink`, `splunk-source`): `splunk:{{mode}}?…` becomes 
`splunk?name={{mode}}&…`, with the same options, checked by hand.
   - **Compact warning:** 187 Kamelets logged it before, 0 after.
   - **At runtime:** the normalized `timer-source` and `log-sink` run in a 
route. The normalized `aws-s3-sink` creates its endpoint (the bucket name given 
as a parameter) and stops at AWS credentials, exactly where the original stops.
   - **Builds:** `./mvnw clean install` and `./mvnw verify` pass. 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:
   1. **The wrong component.** It checked the parameters of `from:` against the 
component of the Kamelet's first dependency. For 
`azure-storage-blob-changefeed-source`, `from:` is a `timer` and its 
`timerName` was checked against `azure-storage-blob`. It now uses the component 
of the `from:` uri, and falls back to the dependency when that is not a known 
component.
   2. **Prefixed options.** It didn't know options taken by prefix, such as 
`mail.imaps.auth.mechanisms` on `imaps`, which fills the mail properties map. 
Those are now accepted.
   
   ### Notes for review
   
   - `nominatim-geocode-action`: `geocoder:address:toOverride` becomes 
`address: address, latlng: toOverride`. The catalog's split of that path is 
odd, but it rebuilds exactly the same uri, so the behaviour is unchanged.
   - The Kamelets work with any Camel 4 runtime: the canonical form is not new 
syntax. Only regenerating them needs the new `camel validate normalize`.
   - A follow-up could add a check that keeps the catalog canonical, failing 
the build when a Kamelet logs the compact notation warning.
   


-- 
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]

Reply via email to