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

   Follows [CAMEL-27371](https://issues.apache.org/jira/browse/CAMEL-27371), 
merged on Camel main for 4.24.0. It changes camel-csv in three ways:
   
   - A new option `headerFromMapKeys=true` writes the header line from the keys 
of the first Map, and those keys become the columns of every row.
   - The names in `header` are trimmed.
   - A null body gives a CSV hint instead of `data.json`.
   
   ## Changes to csv-serialize-action
   
   - The template no longer builds its own header line, and three steps are 
gone:
     - marshalling the keys of the first row into a variable;
     - putting that line in front of the body;
     - the two `choice` blocks that went with them.
   - When `header` is true, the marshal step sets `headerFromMapKeys: true`. 
When `columns` is set, camel-csv uses those columns first, so no condition on 
`columns` is needed.
   - **Behaviour change** for rows with different keys and no `columns`: the 
keys of the first row are now the columns of all the rows.
     - A key that only a later row has is left out.
     - A key that a later row does not have gives an empty value.
     - Before, the later row's values followed its own keys, and the extra key 
got a column without a name in the header line (`2,Bob,,,true`, now `2,Bob,,`). 
The "Good to know" text says this now.
   - `columns`:
     - Spaces around a name are left out, so `id, name` is the same as 
`id,name`. The "without spaces" text is gone.
     - The `pattern: "^[^']*$"` is removed. It existed because the template put 
`columns` in a quoted `simple` text, which it no longer does, so a name can 
hold a single quote now.
   
   ## Tests
   
   Local `CsvIT`: **3 tests, 3 passed**.
   
   The existing cases pass unchanged: round trip, single Map, columns order, 
List rows, an empty List with and without columns, and a text body that fails. 
The parsed-JSON case changes and one case is new:
   
   - **Parsed JSON:** the expectation changes from `2,Bob,,,true` to `2,Bob,,`, 
which is the "key only in a later row" case.
   - **New "Spaces" case:** `columns: "owner's name, id"` gives the header line 
`owner's name,id` and the row `Ann,1`.
   
   ## Upgrade note
   
   ```
   * `csv-serialize-action` without `columns`: the keys of the first Map row 
are the columns of all the rows; a key that only a later row has is left out 
(before, it got a column without a name), and a missing key is empty. `columns` 
may have spaces after the commas and names with a single quote.
   ```
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
   


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