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

RobinTail / express-zod-api / 12125952261

02 Dec 2024 06:49PM UTC coverage: 100.0%. Remained the same
12125952261

Pull #2230

github

web-flow
Merge 98b595894 into d8b105e16
Pull Request #2230: Bump the typescript-eslint group with 2 updates

1189 of 1212 branches covered (98.1%)

4196 of 4196 relevant lines covered (100.0%)

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

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