Repository navigation
feat: export the OpenAPI document the SDKs are generated from - #468
Open
neelneelneel wants to merge 3 commits into
Open
neelneelneel wants to merge 3 commits into
neelneelneel wants to merge 3 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 its REST annotations and from every Semoss reactor. Each reactor's contract is inferred from what it already declares, and annotations refine it where inference can't see. The TypeScript SDK in
libs/sdkgenerates typed REST calls and a types-only 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, and no reactor has to change to be published.
This change spans three repositories:
@semoss/sdk) generates the calls and adds typed hooks.Changes Made
Semoss
ReactorContractreads each reactor's contract from what it already declares. It constructs the reactor to do this but never executes it.keysToGet, by canonical name.keyRequired. With none, nothing is required, which is howorganizeKeys()checks at runtime.getKeyTypeForMCP.getDescriptionForKeyandgetReactorDescription, with placeholders where they're missing.prerna.openapi:@PixelOutputdeclares a reactor's output.@PixelInput(repeatable) refines one input's type, item type, description or requiredness.@Internalmarks a reactor or REST operation as not for general use.ReactorNamesnow holds the Pixel-name and frame-type rules, andReactorFactoryuses it too. Registration is unchanged.Echo,StopPixelExecutionandGetCurrentInsightIdare annotated so their published types are pinned. An earlierAbstractReactor2base class from this branch has been rolled back in favor of inference.swagger-annotations-jakartadependency andReactorContractTest.Monolith
OpenApiExporterandscripts/generate-apiwritetarget/generator/openapi.json. Nothing is listed by hand:@Operationmethod in the servlets' JAX-RS applications is published.x-semoss-pixels. The ~150 frame-specific versions are left out, since the frame picks the implementation at runtime.@Hiddenleaves a REST method or a reactor out.@Internaladdsx-internal(plusx-internal-reasonwhen given). A contract with anything inferred getsx-semoss-inferred.x-semoss-servletsnames each servlet's SDK module.target/generator/skipped.txt. That covers a failing constructor, a duplicate key, a non-identifier name, or a name two classes share. The list is the same on every run. An annotated reactor that can't be read fails the export instead.operationIds.GET /api/config: described by aServerConfigrecord.ServerConfigContractTestkeeps the record in step with what the resource puts, and the response itself is unchanged.openapiMaven profile builds intotarget/openapi-build, apart from IDE output intarget/classes.OpenApiExporterTestwith fixtures (test/openapi/fixtures,test/openapi/badfixtures), anddocs/openapi.md.semoss-ui (
@semoss/sdk)scripts/sdk-generator):pnpm generate --openapi FILEwritessrc/generated/. REST calls are plainasyncfunctions over the existingget/post, with inline types and TSDoc.pnpm generate:check --openapi FILEreports drift without writing anything.@internalforx-internal, and a note on inferred reactors.@semoss/sdk/api/*, starting withconfigfrom@semoss/sdk/api/monolith.PixelCatalogis types only, so it adds no bundle size at any number of reactors.buildPixelis checked against it at compile time and escapes every value.readPixelOutputthrowsPixelErrorwhen the backend reported an error.runPixel,usePixel,useIteratorPixel,runPixelAsyncandgetPixelAsyncResultget typed overloads. Plain strings and explicit type arguments keep the legacy types.useAPI(fn, input, options)passes anAbortSignal, compares its input by value, and takesenabled.useIteratorApican page a generated call directly: it fills inlimitandoffset, acceptsselect, and starts again from page 0 when the input changes, with no deps array. The existing(fetchPage, options, deps)form still works.*.test-d.tswithtsconfig.typecheck.json) and@testing-library/reactfor the hook tests.How to Test