Expose the control plane OpenAPI spec at /v1/openapi.json
Unified · Split
| @@ -17,6 +17,7 @@ import { startMcpElicitationDemoServer } from "@executor/mcp-elicitation-demo"; · 16 unmodified lines | ||
| 17 | 17 | import { makeToolInvokerFromTools, toTool } from "@executor/codemode-core"; |
| 18 | 18 | import { |
| 19 | 19 | createControlPlaneClient, |
| 20 | + controlPlaneOpenApiSpec, | |
| 20 | 21 | type ControlPlaneClient, |
| 21 | 22 | type ResolveExecutionEnvironment, |
| 22 | 23 | SourceIdSchema, |
| @@ -601,6 +602,24 @@ const waitForExecutionCompletion = (input: { · 578 unmodified lines | ||
| 601 | 602 | }); |
| 602 | 603 | |
| 603 | 604 | describe("local-executor-server", () => { |
| 605 | + it.scoped("serves the control-plane OpenAPI spec at /v1/openapi.json", () => | |
| 606 | + Effect.gen(function* () { | |
| 607 | + const server = yield* makeServer; | |
| 608 | + const response = yield* Effect.promise(() => | |
| 609 | + fetch(`${server.baseUrl}/v1/openapi.json`, { | |
| 610 | + headers: { | |
| 611 | + accept: "application/json", | |
| 612 | + }, | |
| 613 | + }), | |
| 614 | + ); | |
| 615 | + const spec = yield* Effect.promise(() => response.json()); | |
| 616 | + | |
| 617 | + expect(response.status).toBe(200); | |
| 618 | + expect(response.headers.get("content-type")).toContain("application/json"); | |
| 619 | + expect(spec).toEqual(controlPlaneOpenApiSpec); | |
| 620 | + }), | |
| 621 | + ); | |
| 622 | + | |
| 604 | 623 | it.scoped("serves the control-plane API and executes code", () => |
| 605 | 624 | Effect.gen(function* () { |
| 606 | 625 | const server = yield* makeServer; |
| @@ -212,7 +212,9 @@ const createControlPlaneWebHandler = (runtime: SqlControlPlaneRuntime) => · 211 unmodified lines | ||
| 212 | 212 | Effect.sync(() => |
| 213 | 213 | HttpApiBuilder.toWebHandler( |
| 214 | 214 | Layer.merge( |
| 215 | − createControlPlaneApiLayer(runtime.runtimeLayer), | |
| 215 | + HttpApiBuilder.middlewareOpenApi({ path: "/v1/openapi.json" }).pipe( | |
| 216 | + Layer.provideMerge(createControlPlaneApiLayer(runtime.runtimeLayer)) | |
| 217 | + ), | |
| 216 | 218 | HttpServer.layerContext, |
| 217 | 219 | ), |
| 218 | 220 | ), |