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
17import { makeToolInvokerFromTools, toTool } from "@executor/codemode-core";17import { makeToolInvokerFromTools, toTool } from "@executor/codemode-core";
18import {18import {
19 createControlPlaneClient,19 createControlPlaneClient,
20 controlPlaneOpenApiSpec,
20 type ControlPlaneClient,21 type ControlPlaneClient,
21 type ResolveExecutionEnvironment,22 type ResolveExecutionEnvironment,
22 SourceIdSchema,23 SourceIdSchema,
@@ -599,6 +600,24 @@ const waitForExecutionCompletion = (input: { · 576 unmodified lines
599 });600 });
600 601
601describe("local-executor-server", () => {602describe("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
602 it.scoped("serves the control-plane API and executes code", () =>621 it.scoped("serves the control-plane API and executes code", () =>
603 Effect.gen(function* () {622 Effect.gen(function* () {
604 const server = yield* makeServer;623 const server = yield* makeServer;