Repository navigation
feat: export the OpenAPI document the SDKs are generated from - #468
Open
neelneelneel wants to merge 2 commits into
Open
neelneelneel wants to merge 2 commits into
neelneelneel wants to merge 2 commits into
Conversation
Add OpenApiExporter and scripts/generate-api, which write target/generator/openapi.json. Nothing is listed by hand: - every @operation method in the servlets' JAX-RS applications is published; - every AbstractReactor2 is published under x-semoss-pixels; - swagger's @hidden leaves an API out, and @internal adds x-internal. The document is OpenAPI 3.1 and canonical: identical across runs, and checked with swagger-parser. x-semoss-servlets names each servlet's SDK module. - Describe GET /api/config with a ServerConfig record, kept in step with the resource by ServerConfigContractTest. - Add an openapi Maven profile that builds into target/openapi-build, apart from IDE output. - Add JUnit 5 and OpenApiExporterTest with fixtures, and docs/openapi.md.feat(contracts): add typed record reactors and OpenAPI export
⛔ Snyk checks have failed. 2 issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This was referenced Nov 4, 2026
Contributor
Author
|
Depends on SEMOSS/semoss-ui#3850 |
OpenApiExporter now publishes every general reactor rather than only AbstractReactor2 subclasses. Each contract is read with Semoss's ReactorContract and refined by @PixelInput and @PixelOutput. - Frame-specific reactors, the per-frame versions ReactorFactory keeps apart, are left out, and so are @hidden ones. - A reactor whose contract cannot be read is left out and listed with the reason in target/generator/skipped.txt, the same on every run. That covers a failing constructor, a non-identifier key or name, and a name claimed by two classes. An annotated reactor fails the export instead. - A contract with anything inferred is marked "x-semoss-inferred": true. - Rewrite the fixtures as plain reactors (inferred, annotated, hidden, internal, unreadable, twice-named and frame-specific), add a failing fixture package, and update docs/openapi.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The backend now owns the API contract and the SDK is generated from it. Monolith exports one OpenAPI 3.1 document, built from annotations in Semoss (reactors) and Monolith (REST resources). The TypeScript SDK in
libs/sdkgenerates typed calls and a typed Pixel catalog from that document; a Python SDK can later read the same file. Everything is opt-in: existing SDK calls keep their behavior and types.This change spans three repositories:
@semoss/sdk) generates the calls and adds typed hooks.Changes Made
Semoss
AbstractReactor2<Input, Output>: a reactor declares its inputs once, as a record.keysToGet,keyRequired, the key descriptions, the MCP types and the typed input all come from that record.NounMetadataautomatically.--help,asMcpTool()and positional inputs still work.Echo,GetCurrentInsightIdandStopPixelExecutionnow extend it. Their outputs and messages are unchanged.@Internal(prerna.openapi.Internal) marks a reactor or REST operation as not for general use.@DynamicOutputmarks a reactor whose output type isn't fixed.swagger-annotations-jakartadependency andAbstractReactor2Test.Monolith
OpenApiExporterandscripts/generate-apiwritetarget/generator/openapi.json. Nothing is listed by hand:@Operationmethod in the servlets' JAX-RS applications, and everyAbstractReactor2(underx-semoss-pixels).@Hidden.x-internal: anything with@Internal.x-semoss-servletsnames each servlet's SDK module.operationIds.GET /api/configis described by aServerConfigrecord.ServerConfigContractTestkeeps the record in step with the keys the resource actually returns. The response itself is unchanged.openapiMaven profile builds intotarget/openapi-build, so stale IDE output intarget/classescan't shadow the Semoss jar.OpenApiExporterTestwith fixtures intest/openapi/fixtures, anddocs/openapi.md.semoss-ui (
@semoss/sdk)scripts/sdk-generator.pnpm generate --openapi FILEwritessrc/generated/. Each call is a plainasyncfunction over the existingget/post, with its types written inline.pnpm generate:check --openapi FILEreports drift.@semoss/sdk/api/*, starting withconfigfrom@semoss/sdk/api/monolith. Calls the backend marks internal get an@internalTSDoc tag.buildPixelandreadPixelOutput, typed by the generatedPixelCatalog.buildPixelwrites every value as an escaped literal.runPixel,usePixel,useIteratorPixel,runPixelAsyncandgetPixelAsyncResult. Plain strings and explicit type arguments keep the legacy types.useAPI(fn, input, options)passes anAbortSignaland compares its input by value.useIteratorApican now page a generated call directly: it fills inlimitandoffsetand accepts aselectfunction. The existing(fetchPage, options, deps)form still works.*.test-d.tswithtsconfig.typecheck.json) and@testing-library/reactfor the hook tests.How to Test