History

Expose control plane OpenAPI spec

TBIQ committed 8 months ago

Commit 581e0521 parent 3348e182 files · +22 −1Browse files

Showing the changes to apps (1 of 2 files). Show all

Unified · Split

apps/executor/src/server/server.test.ts+19−0
@@ -17,6 +17,7 @@ import { startMcpElicitationDemoServer } from "@executor/mcp-elicitation-demo"; · 16 unmodified lines
1717 import { makeToolInvokerFromTools, toTool } from "@executor/codemode-core";
1818 import {
1919 createControlPlaneClient,
20+ controlPlaneOpenApiSpec,
2021 type ControlPlaneClient,
2122 type ResolveExecutionEnvironment,
2223 SourceIdSchema,
@@ -599,6 +600,24 @@ const waitForExecutionCompletion = (input: { · 576 unmodified lines
599600 });
600601
601602 describe("local-executor-server", () => {
603+ it.scoped("serves the control-plane OpenAPI spec at /v1/openapi.json", () =>
604+ Effect.gen(function* () {
605+ const server = yield* makeServer;
606+ const response = yield* Effect.promise(() =>
607+ fetch(`${server.baseUrl}/v1/openapi.json`, {
608+ headers: {
609+ accept: "application/json",
610+ },
611+ }),
612+ );
613+ const spec = yield* Effect.promise(() => response.json());
614+
615+ expect(response.status).toBe(200);
616+ expect(response.headers.get("content-type")).toContain("application/json");
617+ expect(spec).toEqual(controlPlaneOpenApiSpec);
618+ }),
619+ );
620+
602621 it.scoped("serves the control-plane API and executes code", () =>
603622 Effect.gen(function* () {
604623 const server = yield* makeServer;