Closed jandnil closed 7 months ago
Could you try if you can still reproduce this with v4.1.2
? The typings for the additinal documentation properties are also fixed in that version so that all properties are now optional.
Could you check if upgrading to v5.0.0
fixes your issue as it contains multiple changes to the CLI, thanks: https://github.com/blomqma/next-rest-framework/releases/tag/v5.0.0
Hi! First of all thanks for the interesting project ! Unfortunately I have run into an error using latest next.js when generating output. Using src folder and api and routes are copied from the example you have. Error manifest itself as:
npx next-rest-framework generate --debug=true Generating OpenAPI spec... node:events:497 throw er; // Unhandled 'error' event ^
Error: spawn npx ENOENT at ChildProcess._handle.onexit (node:internal/child_process:286:19) at onErrorNT (node:internal/child_process:484:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Emitted 'error' event on ChildProcess instance at: at ChildProcess._handle.onexit (node:internal/child_process:292:12) at onErrorNT (node:internal/child_process:484:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn npx', path: 'npx', spawnargs: [ 'next', 'build' ] }
Node.js v21.2.0
Additionally a difference is that all params needs to be specified now .. like callback deprecated and so on:
Example: const handler = routeHandler({ GET: routeOperation({ operationId: 'getTodos', tags: ['example-api', 'todos', 'app-router'],
callbacks:'', deprecated:'', description:'', externalDocs:'', parameters:'', security:'', servers:'', summary:'', }) // Output schema for strictly-typed responses and OpenAPI documentation. .outputs([ { status: 200, contentType: 'application/json', schema: z.array( z.object({ id: z.number(), name: z.string(), completed: z.boolean() }) ) } ]) .handler(() => { // Type-checked response. return TypedNextResponse.json(TODOS, { status: 200 }); }),
"openapi": "3.0.1", "info": { "title": "Next REST Framework", "description": "This is an autogenerated documentation by Next REST Framework.", "version": "v4.0.0" }, "paths": {}, "components": { "schemas": {} } }