(schema: Schema.Constraint)
| 741 | return map |
| 742 | |
| 743 | function process(schema: Schema.Constraint) { |
| 744 | const annotation = HttpApiSchema.getWithHeadersAnnotation(schema.ast) |
| 745 | const body = HttpApiSchema.isWithHeaders(schema) ? schema.schema : annotation?.body ?? schema |
| 746 | const headers = HttpApiSchema.isWithHeaders(schema) ? schema.headers : annotation?.headersCodec |
| 747 | const status = getStatus(schema) |
| 748 | const ast = body.ast |
| 749 | if (HttpApiSchema.isStreamSchema(body)) { |
| 750 | addStreamContent(body, status) |
| 751 | } else if (HttpApiSchema.isNoContent(ast)) { |
| 752 | addNoContent(status, getDescription(schema.ast) ?? getDescription(ast) ?? "<No Content>") |
| 753 | } else { |
| 754 | addContent( |
| 755 | body, |
| 756 | status, |
| 757 | HttpApiSchema.getResponseEncodingSchema(schema), |
| 758 | getDescription(schema.ast) ?? getDescription(ast) |
| 759 | ) |
| 760 | } |
| 761 | if (headers !== undefined) { |
| 762 | map.get(status)!.headers.push(headers) |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | function addNoContent(status: number, description: string) { |
| 767 | const statusMap = map.get(status) |
nothing calls this directly
no test coverage detected