( endpoint: HttpApiEndpoint.Top, headersOptions: SchemaAST.ParseOptions | undefined )
| 1412 | } |
| 1413 | |
| 1414 | function makeErrorSchema( |
| 1415 | endpoint: HttpApiEndpoint.Top, |
| 1416 | headersOptions: SchemaAST.ParseOptions | undefined |
| 1417 | ): Schema.ConstraintEncoder<HttpServerResponse, unknown> { |
| 1418 | const schemas = HttpApiEndpoint.getErrorSchemas(endpoint).map((schema) => |
| 1419 | toResponseErrorSchema(schema, headersOptions) |
| 1420 | ) |
| 1421 | if (schemas.length === 0) return Schema.Never |
| 1422 | return schemas.length === 1 ? schemas[0] : Schema.Union(schemas) |
| 1423 | } |
| 1424 | |
| 1425 | function toResponseSchema(getStatus: (schema: Schema.Constraint) => number) { |
| 1426 | // WithHeaders wrappers share a single declaration AST, so they are cached by instance |
no test coverage detected