Croway opened a new pull request, #196:
URL: https://github.com/apache/camel-spring-boot-examples/pull/196

   ## Summary
   
   The `document-metadata-extractor` route used 
`docling:EXTRACT_STRUCTURED_DATA` as the endpoint, but `camel-docling` only 
dispatches on the `operation` query parameter (or the `CamelDoclingOperation` 
header) - the URI path segment is descriptive only. Without an explicit 
`operation=...` parameter, the endpoint silently fell back to its 
`CONVERT_TO_MARKDOWN` default, so the "metadata" route was actually just 
converting to markdown and writing it into a `.json` file (invalid JSON).
   
   - Added the missing `operation=CONVERT_TO_MARKDOWN` / 
`operation=EXTRACT_STRUCTURED_DATA` query parameters to both routes, matching 
the pattern already used in `camel-docling`'s own docs/tests.
   - `EXTRACT_STRUCTURED_DATA` returns a `DoclingDocument` object, not JSON 
text (the `outputFormat` parameter isn't read by that operation, and there's no 
type converter for the object), so the route now marshals it to JSON explicitly 
via `camel-jackson` before writing it to file.
   
   I've also filed the root cause against `camel-docling` itself: 
https://github.com/apache/camel/pull/26102 (the `docling:<operationId>` URI 
path segment not being honored). This PR fixes the example regardless of 
when/whether that lands, since the explicit `operation=...` parameter and the 
JSON marshalling step are both needed either way.
   
   ## Test plan
   
   - [x] Reproduced against a live `docling-serve` container (`docker run -p 
5001:5001 ghcr.io/docling-project/docling-serve:latest`)
   - [x] Before: `output/metadata/*.json` contained markdown text, invalid JSON
   - [x] After: `output/metadata/*.json` contains valid, well-formed JSON 
(`DoclingDocument` schema)
   - [x] Verified the primary `document-to-markdown-converter` route still 
produces correct markdown output
   - [x] `mvn clean package` succeeds
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01Hs6c6LpuL8ZZ3gaSXwt7CS


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