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

RobinTail / express-zod-api / 11783971106

11 Nov 2024 06:15PM UTC coverage: 100.0%. Remained the same
11783971106

Pull #2164

github

web-flow
Merge 7cb42cc86 into 919f2d494
Pull Request #2164: Bump the typescript-eslint group with 2 updates

1148 of 1168 branches covered (98.29%)

3893 of 3893 relevant lines covered (100.0%)

382.96 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 = {
6✔
4
  positive: 200,
6✔
5
  negative: 400,
6✔
6
} satisfies Record<string, number>;
6✔
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

© 2025 Coveralls, Inc