Source HTTP API ID path patterns (#26623)

This commit is contained in:
Kit Langton 2026-05-09 22:58:47 -04:00 • committed by GitHub
commit 67b9c9c027
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,14 +69,6 @@ const QueryParameterSchemas: Record<string, OpenApiSchema> = {
"GET /api/session/{sessionID}/message limit": { type: "number" },
}
const PathParameterSchemas: Record<string, OpenApiSchema> = {
sessionID: { type: "string", pattern: "^ses.*" },
messageID: { type: "string", pattern: "^msg.*" },
partID: { type: "string", pattern: "^prt.*" },
permissionID: { type: "string", pattern: "^per.*" },
ptyID: { type: "string", pattern: "^pty.*" },
}
const LegacyComponentDescriptions: Record<string, string> = {
LogLevel: "Log level",
ServerConfig: "Server configuration for opencode serve and web commands",
@ -506,11 +498,8 @@ function normalizeParameter(param: OpenApiParameter, route: string) {
}
function pathParameterSchema(route: string, name: string) {
if (name in PathParameterSchemas) return PathParameterSchemas[name]
if (name === "id" && route.startsWith("DELETE /experimental/workspace/")) return { type: "string", pattern: "^wrk.*" }
if (name === "id" && route.startsWith("POST /experimental/workspace/")) return { type: "string", pattern: "^wrk.*" }
if (name === "requestID" && route.startsWith("POST /permission/")) return { type: "string", pattern: "^per.*" }
if (name === "requestID" && route.startsWith("POST /question/")) return { type: "string", pattern: "^que.*" }
return undefined
}