davsclaus opened a new pull request, #118:
URL: https://github.com/apache/camel-jbang-examples/pull/118

   CAMEL-25765: the contracts rung shows the contract-first REST DSL, but not 
the code-first REST DSL, which most Camel REST applications use. This adds it, 
first in the group, before the contract-first examples.
   
   ## What
   
   - **`contracts/rest-code-first`**, the shop's order API:
     - `GET /orders` and `GET /orders/{id}` answer the orders as JSON through 
`bindingMode: json`. An unknown id gets a 404 with a JSON error.
     - `POST /orders` binds the JSON of a new order to a Java record (`type: 
camel.example.Order`, `Order.java` with a nested `Line` record). It answers 201 
with the order, or 400 when the order has no lines.
     - The API description generated from the operations is served at 
`/openapi` (`apiContextPath`).
   - **README** with the usual sections, and a **Citrus YAML test** that calls 
each operation and `/openapi`, in the CI matrix.
   - **Group order:** openapi-server, openapi-client and keycloak-security-rest 
move down by one. The catalog and the README tables are regenerated.
   
   ## Three things the example handles, which I'll raise separately for Camel
   
   - **`camel run` does not add camel-openapi-java** for a code-first 
`apiContextPath`. The app fails with "Cannot find RestApiProcessorFactory". The 
resolver adds the dependency only for `rest-openapi`. The example declares it 
with `camel.jbang.dependencies=camel:openapi-java`.
   - **Error answers are not bound** (`skipBindingOnErrorCode`), so the 404 and 
400 bodies are JSON text. A Map there fails with "No type converter available 
to convert from type: java.util.LinkedHashMap to the required type: 
java.io.InputStream".
   - **A GET with `Content-Type: text/plain` is answered 500.** The json 
binding skips writing the answer because of the request's content type, even 
when the request has no body. Citrus's HTTP client sends that header by 
default, so the test's GETs set `contentType: application/json`.
   
   ## Checks
   
   - `camel validate yaml --canonical` reports nothing.
   - The routes run on the released Camel 4.23.0, and every operation answers 
as the README shows.
   - The Citrus test passes (TEST SUCCESS).
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
   


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