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

RobinTail / express-zod-api / 12963101280

25 Jan 2025 07:45AM UTC coverage: 100.0%. Remained the same
12963101280

Pull #2304

github

web-flow
Merge 477736c20 into 023e55c27
Pull Request #2304: feat: Client default implementation

1206 of 1228 branches covered (98.21%)

13 of 13 new or added lines in 3 files covered. (100.0%)

4043 of 4043 relevant lines covered (100.0%)

263.52 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
export const responseVariants = Object.keys(
4✔
10
  defaultStatusCodes,
4✔
11
) as ResponseVariant[];
4✔
12

13
/** @public this is the user facing configuration */
14
export interface ApiResponse<S extends z.ZodTypeAny> {
15
  schema: S;
16
  /** @default 200 for a positive and 400 for a negative response */
17
  statusCode?: number | [number, ...number[]];
18
  /**
19
   * @example null is for no content, such as 204 and 302
20
   * @default "application/json"
21
   * */
22
  mimeType?: string | [string, ...string[]] | null;
23
  /** @deprecated use statusCode */
24
  statusCodes?: never;
25
  /** @deprecated use mimeType */
26
  mimeTypes?: never;
27
}
28

29
/**
30
 * @private This is what the framework entities operate
31
 * @see normalize
32
 * */
33
export interface NormalizedResponse {
34
  schema: z.ZodTypeAny;
35
  statusCodes: [number, ...number[]];
36
  mimeTypes: [string, ...string[]] | null;
37
}
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