fix(server): serve HttpApi OpenAPI document (#26438)

This commit is contained in:
Kit Langton
2026-05-08 22:20:50 -04:00
committed by GitHub
parent 0745162eab
commit 9c05d4e2fd
2 changed files with 32 additions and 3 deletions

View File

@@ -48,6 +48,23 @@ const it = testEffect(Layer.mergeAll(testStateLayer, httpApiServerLayer))
const directoryHeader = (dir: string) => HttpClientRequest.setHeader("x-opencode-directory", dir)
describe("instance HttpApi", () => {
it.live("serves the OpenAPI document", () =>
Effect.gen(function* () {
const response = yield* HttpClient.get("/doc")
expect(response.status).toBe(200)
expect(response.headers["content-type"]).toContain("application/json")
expect(yield* response.json).toMatchObject({
openapi: expect.any(String),
info: expect.any(Object),
paths: expect.objectContaining({
"/global/health": expect.any(Object),
"/session": expect.any(Object),
}),
})
}),
)
it.live("serves path and VCS read endpoints", () =>
Effect.gen(function* () {
const dir = yield* tmpdirScoped({ git: true })