Changelog - 2026-05-08
CRUD Route Toggles & Typed JSON Responses
In one line. You can hide generated CRUD routes without a custom controller, and handlers that return the wrong response shape now fail to compile.
What changed
- Per-route
enabledflag. Each entry inroutesacceptsenabled?: boolean(defaulttrue). enabledRouteswhitelist. List the route keys to register; everything else is skipped. It takes priority over the per-route flags.- Typed
context.json().TContextandTRouteContextare generic over the response body, andcontext.json(body, status)is checked against the route's declared response schemas. This is type-level only. - Fix for TS7056. Generated CRUD controllers no longer force TypeScript to serialize the whole route-definitions tree into the
.d.ts, which failed for entities with complex Zod schemas.
typescript
ControllerFactory.defineCrudController({
entity: User,
repository: { name: 'UserRepository' },
controller: {
name: 'UserController',
basePath: '/users',
routes: {
deleteById: { enabled: false },
deleteBy: { enabled: false },
},
},
});
// or register only what you need
controller: {
name: 'StatsController',
basePath: '/stats',
enabledRoutes: ['count'],
}Who is affected
- All users. No action needed. Every route stays enabled unless set to
false, andenabledRoutesis opt-in. - Handlers returning a wrong shape. Handlers that already return the declared shape compile unchanged. Others now get a compile error.