• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RobinTail / express-zod-api / 11692276720

05 Nov 2024 08:48PM UTC coverage: 100.0%. Remained the same
11692276720

Pull #2063

github

web-flow
Merge 2598dc3c5 into ee2b9ec91
Pull Request #2063: Future: Drop Node 18

1131 of 1154 branches covered (98.01%)

6 of 6 new or added lines in 1 file covered. (100.0%)

4027 of 4027 relevant lines covered (100.0%)

255.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/api-response.ts
1
import { z } from "zod";
2

3
export const defaultStatusCodes = {
4✔
4
  positive: 200,
4✔
5
  negative: 400,
4✔
6
} satisfies Record<string, number>;
4✔
7

8
export type ResponseVariant = keyof typeof defaultStatusCodes;
9

10
export interface ApiResponse<S extends z.ZodTypeAny> {
11
  schema: S;
12
  /**
13
   * @default 200 for a positive response
14
   * @default 400 for a negative response
15
   * @override statusCodes
16
   * */
17
  statusCode?: number;
18
  /**
19
   * @default [200] for positive response
20
   * @default [400] for negative response
21
   * */
22
  statusCodes?: [number, ...number[]];
23
  /**
24
   * @default "application/json"
25
   * @override mimeTypes
26
   * */
27
  mimeType?: string;
28
  /** @default [ "application/json" ] */
29
  mimeTypes?: [string, ...string[]];
30
}
31

32
export type NormalizedResponse = Required<
33
  Pick<ApiResponse<z.ZodTypeAny>, "schema" | "statusCodes" | "mimeTypes">
34
>;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc