Closed sorenhansendk closed 1 year ago
I'm not able to use the Swagger module: https://github.com/elysiajs/elysia-swagger
When I request the JSON /swagger/json it return this error in my console:
/swagger/json
56 | registerSchemaPath({ 57 | schema, 58 | hook: route.hooks, 59 | method: route.method, 60 | path: route.path, 61 | models: app.definitions.type, ^ TypeError: undefined is not an object (evaluating 'app.definitions.type') at /Users/sorenhansen/Code/vivens-io/node_modules/@elysiajs/swagger/dist/index.js:61:28 at forEach (:1:20) at /Users/sorenhansen/Code/vivens-io/node_modules/@elysiajs/swagger/dist/index.js:55:12 GET - /swagger/json failed
My route file looks like this:
export default (app: Elysia) => app.use(db).get( '', async ({ db }) => { return [{ id: "1", name: "demo", }] }, { type: 'application/json', detail: { tags: ['test'], }, response: { 200: t.Array( t.Object({ id: t.String(), name: t.String(), }), ), }, }, );
It works! I forgot to align my versions of the packages:
elysia
@elysiajs/swagger
I'm not able to use the Swagger module: https://github.com/elysiajs/elysia-swagger
When I request the JSON
/swagger/json
it return this error in my console:My route file looks like this: