Releases: laurence79/express-typescript-codegen
0.37.0
Features
-
New
mock-servertemplate. Generates a leaner Express output for use as a typed mock API in integration tests.express-typescript-codegen generate spec.yaml --template mock-server
Same public API as the
expresstemplate (addHandlers(app, handlers),Handlersmap, per-op${Op}Handlertype), so swapping is a one-line change inpackage.json. The differences:- No request validation: drops
express-json-validator-middleware, inlined JSON schemas, and the validation error handler. Bad request bodies hit your handler logic, not a 400 wall — appropriate for test mocks where you don't want validation hiding app bugs. - No
${Op}Requestcollision: theRequest<...>/Response<...>wrappers are inlined inside${Op}Handlerrather than exported as separate aliases, so user schemas titled${Op}Requestno longer clash with handler types.
Supports both OpenAPI v3 and Swagger v2. Output is roughly 35% smaller than the
expresstemplate on the same spec.The existing
expresstemplate is unchanged. - No request validation: drops
0.36.0
Features
-
Runtime const arrays for named enums. Named enum schemas (those with a
title) now also emit anas constarray of the values, with the type derived from the array. Inline enums are unchanged.Generated output:
export const EnabledOrganizations = ['all', 'none', 'selected'] as const; export type EnabledOrganizations = (typeof EnabledOrganizations)[number];
Consumers can iterate enum values at runtime, build maps, or validate input without redefining the values.
import type { ... }continues to erase the const at runtime; bundlers tree-shake unused exports.
0.35.3
What's Changed
- fix: resolve cross-file PathItemObject
$refentries
PathItem-level $refs (e.g. /things/{thingId}: { $ref: './paths/things.yaml#/getThing' }) were falling through the generic component-inlining branch and getting stashed under #/components/schemas/<title> while the path entry retained a local $ref. Because methodsOfPathItemObject skips $ref, the referenced operations were silently dropped from generated output. In some configurations the path key could also be URL-encoded when building an internal JSON pointer, surfacing Invalid reference token: /things/%7BthingId%7D.
PathItem-position $refs are now inlined in place, preserving the original path key verbatim.
Full Changelog: 0.35.2...0.35.3
0.35.2
What's Changed
- fix: prevent OOM when loading multi-file OpenAPI specs by @laurence79 in #5
Full Changelog: 0.35.1...0.35.2
0.35.1
fix: Default fetch is unbound
0.35.0
Full Changelog: 0.34.0...0.35.0
0.34.0
Full Changelog: 0.33.0...0.34.0
0.33.0
Full Changelog: 0.32.0...0.33.0
0.32.0
Full Changelog: 0.31.0...0.32.0
0.31.0
Full Changelog: 0.30.0...0.31.0