gnodet opened a new pull request, #31240:
URL: https://github.com/apache/camel/pull/31240

   ## Summary
   
   Fix `CamelStitchKeyNames` header handling in `camel-stitch` so that setting 
it as a `Collection<String>` (e.g. `List.of("field_1","field_2")`) works 
correctly, matching the documented `javaType`.
   
   ## Root Cause
   
   `StitchConstants.KEY_NAMES` declared `javaType = "Collection<String>"` in 
`@Metadata`, but `StitchProducerOperations.getKeyNames()` read the header as 
`String.class` using the generic `getOption()` helper. When a user set the 
header as `List.of("a","b")`, Camel's type converter produced `"[a, b]"` via 
`toString()`, which then got split on commas into `["[a", " b]"]` — broken key 
names including brackets and spaces.
   
   ## Fix
   
   - `getKeyNames()` now checks `header instanceof Collection` first and 
returns it directly (unchanged).
   - Falls back to string-split only when the header is a plain `String` 
(backward-compatible with the existing pattern).
   - Updated `@Metadata javaType` to `"Collection<String> or String"` and the 
description to match.
   - Updated both generated JSON copies (component metadata and catalog mirror) 
accordingly.
   
   ## Tests
   
   Added `testKeyNamesAsCollectionHeader()` to `StitchProducerOperationsTest`: 
sets `CamelStitchKeyNames` as `List.of("field_1","field_2")` and asserts the 
resulting JSON has `"key_names":["field_1","field_2"]` — the broken case would 
have produced `"key_names":["[field_1"," field_2]"]`.
   
   All 31 existing module tests continue to pass.
   
   Fixes CAMEL-28019
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


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