lukeautry / tsoa

Build OpenAPI-compliant REST APIs using TypeScript and Node
MIT License
3.45k stars 494 forks source link

Decorators not working. swagger json contains empty fields #1491

Closed muhammadharis1212 closed 10 months ago

muhammadharis1212 commented 11 months ago

Swagger json outputs file which has empty fields so the documentation remains empty. Decorators are not working.

tsoa.json file:

{ "controllerPathGlobs": ["./src/controllers/**/*.controller.ts"], "modelPathGlobs": ["./src/models/**/*.model.ts"], "routes": { "routesDir": "./src/routes" }, "entryFile": "src/server.ts", "noImplicitAdditionalProperties": "throw-on-extras", "spec": { "outputDirectory": "public", "specVersion": 3 } }

Controller file: @Route('users') export class UserController { public user = Container.get(UserService); @Get('/') public getUsers = async (req: Request, res: Response, next: NextFunction) => { try { const findAllUsersData: User[] = await this.user.findAllUser(); res.status(200).json({ data: findAllUsersData, message: 'success' }); } catch (error) { next(error); } }; }

swagger.json file: { "components": { "examples": {}, "headers": {}, "parameters": {}, "requestBodies": {}, "responses": {}, "schemas": {}, "securitySchemes": {} }, "info": { "title": "erp-server", "version": "1.0.0", "description": "TypeScript + Mongoose + MongoDB + Express API Server", "license": { "name": "ISC" }, "contact": {} }, "openapi": "3.0.0", "paths": {}, "servers": [ { "url": "/" } ] }

github-actions[bot] commented 11 months ago

Hello there muhammadharis1212 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days