mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-27 17:28:50 +00:00
feat(server): Server.openapi() backed by HttpApi spec, parity-checked against Hono output (#25545)
This commit is contained in:
parent
3c9f3c5786
commit
0ee3b87289
6 changed files with 48 additions and 15 deletions
|
|
@ -222,7 +222,7 @@ describe("HttpApi server", () => {
|
|||
})
|
||||
|
||||
test("covers every generated OpenAPI route with Effect HttpApi contracts", async () => {
|
||||
const honoRoutes = openApiRouteKeys(await Server.openapi())
|
||||
const honoRoutes = openApiRouteKeys(await Server.openapiHono())
|
||||
const effectRoutes = openApiRouteKeys(effectOpenApi())
|
||||
|
||||
expect(honoRoutes.filter((route) => !effectRoutes.includes(route))).toEqual([])
|
||||
|
|
@ -237,7 +237,7 @@ describe("HttpApi server", () => {
|
|||
})
|
||||
|
||||
test("matches generated OpenAPI route parameters", async () => {
|
||||
const hono = openApiParameters(await Server.openapi())
|
||||
const hono = openApiParameters(await Server.openapiHono())
|
||||
const effect = openApiParameters(effectOpenApi())
|
||||
|
||||
expect(
|
||||
|
|
@ -248,7 +248,7 @@ describe("HttpApi server", () => {
|
|||
})
|
||||
|
||||
test("matches generated OpenAPI request body shape", async () => {
|
||||
const hono = openApiRequestBodies(await Server.openapi())
|
||||
const hono = openApiRequestBodies(await Server.openapiHono())
|
||||
const effect = openApiRequestBodies(effectOpenApi())
|
||||
|
||||
expect(
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ afterEach(async () => {
|
|||
|
||||
describe("tui HttpApi bridge", () => {
|
||||
test("documents legacy bad request responses", async () => {
|
||||
const legacy = await Server.openapi()
|
||||
const legacy = await Server.openapiHono()
|
||||
const effect = OpenApi.fromApi(TuiApi)
|
||||
for (const path of [TuiPaths.appendPrompt, TuiPaths.executeCommand, TuiPaths.publish, TuiPaths.selectSession]) {
|
||||
expect(legacy.paths[path].post?.responses?.[400]).toBeDefined()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue