davsclaus opened a new pull request, #25885:
URL: https://github.com/apache/camel/pull/25885
## Summary
Follow-up to CAMEL-24514 (#25883): generate a **static** OpenAPI 3.0 spec
describing every dev
console's `/q/dev/{id}` endpoint at build time, published as part of
`camel-catalog`, so tooling
can discover the dev console API surface without a running `CamelContext`.
Rather than duplicate `ApiDevConsole`'s path/operation-building logic
between the live console and
a new build-time generator, this extracts it into a shared class:
- **`DevConsoleOpenApiHelper`** (new, `tooling/camel-tooling-model`) —
builds the OpenAPI document/
path-item JSON from `DevConsoleModel`/`DevConsoleOptionModel` typed beans.
Both consumers already
have (or can cheaply get) these beans:
- `ApiDevConsole` (`core/camel-console`) now parses each live console's
catalog schema via
`JsonMapper.generateDevConsoleModel()` and delegates to the helper,
instead of hand-rolling
JSON navigation — a behavior-preserving simplification (existing
`ApiDevConsoleTest` passes
unchanged).
- `PrepareCatalogMojo.executeDevConsoles()`
(`tooling/maven/camel-package-maven-plugin`) already
parses every module's `dev-console/<id>.json` into a `DevConsoleModel`
while aggregating them
into `camel-catalog` — it now also builds one consolidated
`dev-consoles-openapi.json` from
those same models via the helper, with zero additional parsing and no
`CamelContext` involved.
- Added the `readOnly` flag (from CAMEL-24514) to `DevConsoleModel` and
`JsonMapper`'s
generate/serialize methods — it existed in the raw catalog JSON but was
never wired into the
typed model.
- New `CamelCatalog.devConsolesOpenApiSpec()` method exposes the static
spec, mirroring the
existing `mainJsonSchema()`/`jbangJsonSchema()` raw-resource pattern.
`core/camel-console` gains a new compile dependency on `camel-tooling-model`
— precedented by
`core/camel-core-catalog`, which already depends on it for the same kind of
catalog-consumption
reason. `tooling/maven/camel-package-maven-plugin` needed no new dependency
(already had it).
## Test plan
- [x] `tooling/camel-tooling-model`: `mvn verify` — new
`DevConsoleOpenApiHelperTest` (4 tests:
read-only→get+parameters, mutating→post+requestBody,
no-options→neither, full document
assembly) plus existing `JsonMapperTest` etc. — 22/22 pass.
- [x] `core/camel-console`: `mvn verify` — 142/142 pass, including the
existing `ApiDevConsoleTest`
unchanged (confirms the refactor is behavior-preserving).
- [x] `tooling/maven/camel-package-maven-plugin`: builds clean.
- [x] `catalog/camel-catalog`: `mvn verify` — 1011/1011 pass
(`CamelCatalogTest`,
`CamelCatalogCacheTest`, etc.), including new
`devConsolesOpenApiSpec()` test. Regenerated
`dev-consoles-openapi.json` contains 78 paths; spot-checked
`/q/dev/context` is `get` and
`/q/dev/route` is `post` with a full `requestBody` schema.
- [x] `core/camel-core-catalog`: still builds/tests clean (also depends on
`camel-tooling-model`).
- [x] `mvn -Psourcecheck` clean on all touched modules.
_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]