| 417 | * @internal |
| 418 | */ |
| 419 | export function getErrorSchemas(endpoint: Top): Array<Schema.Top> { |
| 420 | const schemas = new Set<Schema.Top>(endpoint.error) |
| 421 | const transform = endpoint.disableCodecs ? identity : transformResponseSchema |
| 422 | for (const middleware of endpoint.middlewares) { |
| 423 | const key = middleware as any as HttpApiMiddleware.AnyService |
| 424 | for (const schema of key.error) { |
| 425 | schemas.add(transform(schema)) |
| 426 | } |
| 427 | } |
| 428 | return Array.from(schemas) |
| 429 | } |
| 430 | |
| 431 | /** |
| 432 | * A widened `HttpApiEndpoint` type used when the concrete method, path, schemas, |