test(generate): add sdk drift guardrails
This commit is contained in:
parent
4ed3afea84
commit
3dee1e7acd
3 changed files with 37 additions and 0 deletions
30
packages/opencode/test/server/question-openapi.test.ts
Normal file
30
packages/opencode/test/server/question-openapi.test.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { describe, expect, test } from "bun:test"
|
||||
import { Server } from "../../src/server/server"
|
||||
|
||||
describe("question openapi", () => {
|
||||
test("keeps the public reply body inline", async () => {
|
||||
const spec = await Server.openapi()
|
||||
const body = spec.paths["/question/{requestID}/reply"]?.post?.requestBody
|
||||
|
||||
expect(body).toBeDefined()
|
||||
if (!body || "$ref" in body) throw new Error("expected inline request body")
|
||||
|
||||
const media = body.content["application/json"]
|
||||
expect(media).toBeDefined()
|
||||
if (!media || "$ref" in media) throw new Error("expected inline json media type")
|
||||
|
||||
expect(media.schema).toMatchObject({
|
||||
type: "object",
|
||||
required: ["answers"],
|
||||
properties: {
|
||||
answers: {
|
||||
description: "User answers in order of questions (each answer is an array of selected labels)",
|
||||
type: "array",
|
||||
items: {
|
||||
$ref: "#/components/schemas/QuestionAnswer",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue