jamesnetherton opened a new pull request, #555:
URL: https://github.com/apache/camel-quarkus-examples/pull/555

   `CustomPojoStore.asString()` hand-built its JSON response by concatenating 
`CustomPojo.toString()` values, and that `toString()` was itself a 
`String.format` into a JSON-shaped template. The interpolated values 
(`customerName`, `summary`) are LLM output, so a single `"` or `\` in a model 
response makes `/custom-pojo-store` serve malformed JSON.
   
   Splicing model output into a structured format is a bad habit to demonstrate 
in an AI example specifically, so the store now returns the `CustomPojo` 
objects and the route marshals them:
   
   ```java
   from("platform-http:/custom-pojo-store?produces=application/json")
           .bean(customPojoStore)
           .marshal().json(JsonLibrary.Jackson);
   ```
   
   `CustomPojo.toString()` stays human-readable for the log line, but no longer 
pretends to be JSON.
   
   ### Response shape change
   
   The `{"pojos": [...]}` envelope, `customerName` and `summary` are unchanged. 
Two fields now serialise as their actual Java types rather than as pre-rendered 
strings:
   
   | Field | Before | After |
   |---|---|---|
   | `customerSatisfied` | `"true"` | `true` |
   | `customerBirthday` | `"10 JULY 1986"` | `{"year":1986,"month":7,"day":10}` 
|
   
   The endpoint is demo/test-only and is not documented in the README, so 
nothing else consumes it. `RouteTest` and the README log sample are updated to 
match.
   
   Preserving the old wire format would mean `@JsonValue` / `@JsonFormat` 
annotations on `CustomPojo` and `Birthday` — but those classes are also the 
LangChain4j deserialisation target and the source of the JSON schema the model 
is constrained to, so changing their JSON representation risks breaking 
extraction. Taking the shape change seemed the safer and more honest option; 
happy to revisit if you'd rather keep the endpoint's output byte-compatible.
   
   Verified with `mvn clean verify -Dnative` (JVM and native both green).
   
   _Claude Code on behalf of James Netherton_


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