Skip to content

Commit 9727140

Browse files
authored
Merge branch 'master' into limit-combinations
2 parents 01d7d38 + 7757d69 commit 9727140

7 files changed

Lines changed: 248 additions & 251 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ const schema = z.object({
2727
// { id: 1, name: "john", age: 18, role: "admin", active: true, tags: ["vip"] },
2828
// ...and 59 more
2929
```
30+
### v27.2.5
31+
32+
- Reduced memory footprint at runtime: deferred population of well-known headers to Documentation;
33+
- Faster header lookup in Documentation generator (only when `headers` enabled in `inputSources`).
3034

3135
### v27.2.4
3236

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { bench } from "vitest";
2+
import { getWellKnownHeaders } from "../src/well-known-headers";
3+
4+
const target = "x-frame-options";
5+
6+
describe("Array.includes vs Set.has for well-known headers lookup", () => {
7+
const headersArray = Array.from(getWellKnownHeaders());
8+
9+
bench("Array.includes", () => {
10+
headersArray.includes(target);
11+
});
12+
13+
bench("Set.has", () => {
14+
getWellKnownHeaders().has(target);
15+
});
16+
});

express-zod-api/bench/queue-ops.bench.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

express-zod-api/src/documentation-helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import { ezRawBrand } from "./raw-schema";
4545
import { FirstPartyKind } from "./schema-walker";
4646
import { Security } from "./security";
4747
import { ezUploadBrand } from "./upload-schema";
48-
import wellKnownHeaders from "./well-known-headers";
48+
import { getWellKnownHeaders } from "./well-known-headers";
4949

5050
interface ReqResCommons {
5151
makeRef: (
@@ -272,7 +272,7 @@ export const defaultIsHeader = (
272272
): name is `x-${string}` =>
273273
familiar?.has(name) ||
274274
name.startsWith("x-") ||
275-
wellKnownHeaders.includes(name);
275+
getWellKnownHeaders().has(name);
276276

277277
export const depictRequestParams = ({
278278
path,

0 commit comments

Comments
 (0)