fix(httpapi): expose v2 catalog errors (#28498)
This commit is contained in:
@@ -61,9 +61,9 @@ describe("PublicApi OpenAPI v2 errors", () => {
|
||||
return ref ? [`${route.method.toUpperCase()} ${route.path} ${status} ${componentName(ref)}`] : []
|
||||
}),
|
||||
)
|
||||
.filter((entry) => entry.includes("BadRequestError") || entry.includes("NotFoundError"))
|
||||
.filter((entry) => entry.endsWith(" BadRequestError") || entry.endsWith(" NotFoundError"))
|
||||
|
||||
expect(refs).toEqual(["GET /api/provider/{providerID} 404 NotFoundError"])
|
||||
expect(refs).toEqual([])
|
||||
})
|
||||
|
||||
test("new /api endpoint errors cannot use built-in components without an explicit allowlist", () => {
|
||||
@@ -82,4 +82,21 @@ describe("PublicApi OpenAPI v2 errors", () => {
|
||||
|
||||
expect(builtInEndpointErrors).toEqual(allowedV2BuiltInEndpointErrors)
|
||||
})
|
||||
|
||||
test("documents v2 provider and model catalog errors", () => {
|
||||
const spec = OpenApi.fromApi(PublicApi) as OpenApiSpec
|
||||
|
||||
expect(componentName(responseRef(spec.paths["/api/provider"]?.get?.responses?.["503"]) ?? "")).toBe(
|
||||
"ServiceUnavailableError",
|
||||
)
|
||||
expect(componentName(responseRef(spec.paths["/api/model"]?.get?.responses?.["503"]) ?? "")).toBe(
|
||||
"ServiceUnavailableError",
|
||||
)
|
||||
expect(componentName(responseRef(spec.paths["/api/provider/{providerID}"]?.get?.responses?.["404"]) ?? "")).toBe(
|
||||
"ProviderNotFoundError",
|
||||
)
|
||||
expect(componentName(responseRef(spec.paths["/api/provider/{providerID}"]?.get?.responses?.["503"]) ?? "")).toBe(
|
||||
"ServiceUnavailableError",
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user