davsclaus opened a new pull request, #25883:
URL: https://github.com/apache/camel/pull/25883
## Summary
`ApiDevConsole` (the `api` dev console) generates an OpenAPI 3.0 spec
describing every `/q/dev/{id}` endpoint. Previously every path was hardcoded to
`post`, even though `/q/dev` was originally GET-only at the transport layer and
the vast majority of consoles are safe, read-only introspection endpoints. POST
was only added later (CAMEL-24054) for a handful of consoles that need to pass
an arbitrary/complex body.
This PR:
- Adds a `readOnly` attribute to the `@DevConsole` annotation (default
`true`), so each console declares whether invoking it is safe or mutates
runtime state.
- `AbstractDevConsole.isReadOnly()` reads this reflectively from the
console's own annotation, so no per-console boilerplate is needed beyond the
annotation attribute.
- `ApiDevConsole.buildOpenApi()` now generates a `get` operation (with query
`parameters`) for read-only consoles, and keeps `post` (with a JSON
`requestBody`) only for consoles that mutate state or need a complex body:
`eval-language`, `send`, `sql-query`, `route`, `route-group`, `processor`,
`trace`, `jfr-memory-leak`, `receive`, `debug`, `heap-dump`, `reload` (core),
and `jfr` (camel-jfr).
- `GenerateDevConsoleMojo` now emits the `readOnly` flag into each console's
generated catalog JSON (`dev-console/*.json`), so the classification is also
available statically at build time — ahead of a planned release-time static
OpenAPI doc generator that won't require a running `CamelContext`.
- Regenerated the catalog JSON for every module with a `@DevConsole` class
(~26 modules) to pick up the new field.
No transport-level change: `ManagementHttpServer` already accepted both GET
and POST identically before this change — this PR only fixes what the OpenAPI
spec *advertises*.
## Test plan
- [x] `core/camel-console`: `mvn verify` — 142/142 tests pass, including new
`ApiDevConsoleTest` (read-only console → `get`, mutating console → `post` +
`requestBody`, `isReadOnly()` defaults).
- [x] `components/camel-jfr`: `mvn verify` — 34/34 tests pass, including a
new `isReadOnly()` assertion on `CamelJfrDevConsole`.
- [x] `core/camel-api`, `core/camel-support`, `tooling/spi-annotations`,
`tooling/maven/camel-package-maven-plugin`: build clean.
- [x] `mvn -Psourcecheck` clean on all directly-modified modules
(formatting/import-order/license).
- [x] Regenerated and spot-checked `dev-console/*.json` across all ~26
affected modules: 82 files now carry `"readOnly"`, correctly `false` only for
the 13 mutating consoles.
_Claude Sonnet 5 on behalf of @davsclaus_
--
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]