atiaomar1978-hub opened a new pull request, #25202:
URL: https://github.com/apache/camel/pull/25202

   ## Summary
   
   Implements [CAMEL-18552](https://issues.apache.org/jira/browse/CAMEL-18552): 
Camel JBang can expose a Swagger UI for REST DSL OpenAPI, similar in spirit to 
the Hawtio integration pattern.
   
   - New **`camel run … --openapi-ui`** flag (also available on `dev` / `debug` 
via inherited `Run` options).
   - Swagger UI is served at **`http://localhost:8080/q/openapi`** (bundled 
`swagger-ui` webjar on the embedded management server).
   - The generated OpenAPI document is exposed at **`/q/openapi.json`** via 
REST DSL (`camel.rest.apiContextPath`), which the UI loads automatically.
   - JBang adds runtime deps `camel-platform-http-main` and 
`camel-openapi-java` when the flag is set and enables HTTP on port 8080 if no 
`--port` was given.
   - Standalone Camel Main can also enable the UI with 
`camel.management.openapiUiEnabled=true` (documented in `main.adoc` metadata).
   
   ## Design notes
   
   | Endpoint | Purpose |
   |----------|---------|
   | `/q/openapi` | Swagger UI (HTML + static webjar assets under 
`/q/openapi/webjars/*`) |
   | `/q/openapi.json` | OpenAPI 3.x JSON from REST DSL (`rest-api` + 
`camel-openapi-java`) |
   
   This keeps the TUI/http tab contract endpoint as JSON at `/q/openapi.json` 
while honoring the JIRA request to browse the API at `/q/openapi`.
   
   ## Tests
   
   - `OpenApiUiHttpServerTest` — UI HTML and CSS webjar responses
   - `OpenApiUiRestMainTest` — end-to-end Main + REST route + spec + UI
   - `RunOpenApiUiOptionsTest` — Picocli parsing of `--openapi-ui`
   
   ```bash
   mvn test -pl components/camel-platform-http-main 
-Dtest=OpenApiUiHttpServerTest,OpenApiUiRestMainTest
   mvn test -pl dsl/camel-jbang/camel-jbang-core -Dtest=RunOpenApiUiOptionsTest
   ```
   
   ## Docs
   
   - User guide: `camel-jbang-managing.adoc` (new OpenAPI Swagger UI section)
   - Generated JBang command/config metadata and `main.adoc` configuration 
entries
   
   ## Test plan
   
   - [x] Unit tests above pass locally (Java 21)
   - [ ] Manual: `camel run <rest-sample.java> --openapi-ui` and open 
`/q/openapi` in a browser
   - [ ] Manual: verify `/q/openapi.json` returns OpenAPI for REST DSL routes
   
   ---
   _AI-generated PR description on behalf of 
[atiaomar1978-hub](https://github.com/atiaomar1978-hub)_
   
   Made with [Cursor](https://cursor.com)


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