mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-13 23:52:06 +00:00
Source diff message query pattern (#26638)
This commit is contained in:
@@ -62,7 +62,6 @@ const QueryParameterSchemas: Record<string, OpenApiSchema> = {
|
||||
"GET /experimental/session limit": { type: "number" },
|
||||
"GET /session start": { type: "number" },
|
||||
"GET /session limit": { type: "number" },
|
||||
"GET /session/{sessionID}/diff messageID": { type: "string", pattern: "^msg.*" },
|
||||
"GET /session/{sessionID}/message limit": { type: "integer", minimum: 0, maximum: Number.MAX_SAFE_INTEGER },
|
||||
"GET /api/session limit": { type: "number" },
|
||||
"GET /api/session start": { type: "number" },
|
||||
|
||||
@@ -75,6 +75,10 @@ const numericSdkQueryParams = [
|
||||
{ method: "get", path: "/api/session/:sessionID/message", name: "limit", schema: { type: "number" } },
|
||||
] satisfies Array<{ method: Method; path: string; name: string; schema: OpenApiSchema }>
|
||||
|
||||
const queryParamPatterns = [
|
||||
{ method: "get", path: SessionPaths.diff, name: "messageID", pattern: "^msg" },
|
||||
] satisfies Array<{ method: Method; path: string; name: string; pattern: string }>
|
||||
|
||||
const pathParamPatterns = [
|
||||
{ method: "get", path: SessionPaths.get, name: "sessionID", pattern: "^ses" },
|
||||
{ method: "get", path: SessionPaths.message, name: "messageID", pattern: "^msg" },
|
||||
@@ -169,6 +173,19 @@ describe("httpapi query schema drift", () => {
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect(
|
||||
"OpenAPI query parameter patterns come from runtime schemas",
|
||||
Effect.sync(() => {
|
||||
const spec = OpenApi.fromApi(PublicApi)
|
||||
for (const expected of queryParamPatterns) {
|
||||
expect(
|
||||
queryParameter(spec.paths[openApiPath(expected.path)]?.[expected.method], expected.name)?.schema,
|
||||
`${expected.method.toUpperCase()} ${expected.path} ${expected.name}`,
|
||||
).toEqual({ type: "string", pattern: expected.pattern })
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect(
|
||||
"OpenAPI workspace query params are declared by runtime query schemas",
|
||||
Effect.sync(() => {
|
||||
|
||||
Reference in New Issue
Block a user