{"_id":"@2amtech/crudx-swagger","_rev":"3-6f8df2349a036db5278ece8ad99bf383","name":"@2amtech/crudx-swagger","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@2amtech/crudx-swagger","version":"1.0.0","keywords":["typescript","nest","nestjs","api","crud","swagger-docs","docs"],"author":{"url":"https://2am.tech/","name":"Antonio Ramirez Cobos","email":"hola@2amigos.us"},"_id":"@2amtech/crudx-swagger@1.0.0","maintainers":[{"name":"2amtech","email":"accounts@2am.tech"}],"contributors":[{"name":"Jonatas Souza","email":"hola@2amigos.us"},{"name":"Aleksandar Panic","email":"hola@2amigos.us"}],"dist":{"shasum":"04747c0cfbabd7add46b1cef7507b5f34ad3167a","tarball":"https://registry.npmjs.org/@2amtech/crudx-swagger/-/crudx-swagger-1.0.0.tgz","fileCount":18,"integrity":"sha512-cRZwulp6ah0XuS8e9Ud6Pe0RU49mW1PQVFuh4gGT76G61rHj2ujpfbdQuxDuI5nBwai6Utvhn9YNFuvwEveIIQ==","signatures":[{"sig":"MEQCIHCBq33DdkAJuTNqRbdHrTIBO2aKk3aDTzoS+YP+thR/AiAD9nW/nQMx6vEYDqIfvngVmnkFSKvwWQPGdlcQzBIzbQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43098},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"afcec310db3e5047b8db3be90c2e04ee84e28f1c","typings":"./src/index.d.ts","_npmUser":{"name":"2amtech","email":"accounts@2am.tech"},"_npmVersion":"10.2.4","description":"NestJs package to apply swagger meta-data into routes generated with @2amtech/crudx package","directories":{},"_nodeVersion":"20.11.1","dependencies":{"tslib":"^2.3.0","lodash":"^4.17.21","@2amtech/crudx":"1.0.0","@nestjs/common":"^10.1.3","@nestjs/swagger":"^7.1.6"},"_hasShrinkwrap":false,"devDependencies":{"supertest":"^6.3.4","@types/uuid":"^9.0.8","@2amtech/crudx":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/crudx-swagger_1.0.0_1722869885698_0.7648237768169408","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@2amtech/crudx-swagger","version":"1.0.1","keywords":["typescript","nest","nestjs","api","crud","swagger-docs","docs"],"author":{"url":"https://2am.tech/","name":"Antonio Ramirez Cobos","email":"hola@2amigos.us"},"_id":"@2amtech/crudx-swagger@1.0.1","maintainers":[{"name":"2amtech","email":"accounts@2am.tech"}],"contributors":[{"name":"Jonatas Souza","email":"hola@2amigos.us"},{"name":"Aleksandar Panic","email":"hola@2amigos.us"}],"dist":{"shasum":"c4fb117d0ef2043322551563b61a54e449a76952","tarball":"https://registry.npmjs.org/@2amtech/crudx-swagger/-/crudx-swagger-1.0.1.tgz","fileCount":18,"integrity":"sha512-2Wxb9MUI4yBz8QYMaaQZVmFRrUzRF28VO0iviJAB+yegPFAZPMvTm+kK9LP/Hj++KThIPIFVWCruDbiwtZjJ+Q==","signatures":[{"sig":"MEUCIQCPxfUfd3k2wa0GrPE4c8U3a0dA1VNQddyHf7fo3cg28wIgBnrAP0kxQARhSZdeJDZPU3TYB3zcxhuqS+h0SMxFIkQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43092},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"2bc6778c2a340fd57cd02c464fa66e3dac09dc2b","typings":"./src/index.d.ts","_npmUser":{"name":"2amtech","email":"accounts@2am.tech"},"_npmVersion":"10.2.4","description":"NestJs package to apply swagger meta-data into routes generated with @2amtech/crudx package","directories":{},"_nodeVersion":"20.11.1","dependencies":{"tslib":"^2.3.0","lodash":"^4.17.21","@2amtech/crudx":"1.0.0","@nestjs/common":"^10.1.3","@nestjs/swagger":"^7.1.6"},"_hasShrinkwrap":false,"devDependencies":{"supertest":"^6.3.4","@types/uuid":"^9.0.8","@2amtech/crudx":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/crudx-swagger_1.0.1_1724323319679_0.28370137348897617","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@2amtech/crudx-swagger","version":"1.0.3","keywords":["typescript","nest","nestjs","api","crud","swagger-docs","docs"],"author":{"url":"https://2am.tech/","name":"Antonio Ramirez Cobos","email":"hola@2amigos.us"},"_id":"@2amtech/crudx-swagger@1.0.3","maintainers":[{"name":"2amtech","email":"accounts@2am.tech"}],"contributors":[{"name":"Jonatas Souza","email":"hola@2amigos.us"},{"name":"Aleksandar Panic","email":"hola@2amigos.us"}],"homepage":"https://github.com/2amigos/nest-kit#readme","bugs":{"url":"https://github.com/2amigos/nest-kit/issues"},"dist":{"shasum":"7acc5f227b520c456525d6b6bb995e50c89efbd9","tarball":"https://registry.npmjs.org/@2amtech/crudx-swagger/-/crudx-swagger-1.0.3.tgz","fileCount":18,"integrity":"sha512-iYQkyHPIVtHWhFvTISdrmWzZO+vcAwh6h204lup+E1O0JPe+7z36eZGYuK7QTqrroAYhxxXXWV2XGC2XNnt/JA==","signatures":[{"sig":"MEYCIQCY43F5vyF7T+ssPueSuXxqOjYn/XIGmwVZbv2hPoD6ngIhANFhZ+zr/Rp/r8TLoLTdt+/i9jBO0Oay70e/UfGWp4Ba","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@2amtech%2fcrudx-swagger@1.0.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":42273},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"6820fecf04db38fc255e4199430e443211eaead4","typings":"./src/index.d.ts","_npmUser":{"name":"2amtech","email":"accounts@2am.tech"},"repository":{"url":"git+https://github.com/2amigos/nest-kit.git"},"_npmVersion":"10.8.2","description":"NestJs package to apply swagger meta-data into routes generated with @2amtech/crudx package","directories":{},"_nodeVersion":"18.20.5","dependencies":{"tslib":"^2.3.0","lodash":"^4.17.21","@2amtech/crudx":"1.0.0","@nestjs/common":"^10.1.3","@nestjs/swagger":"^7.1.6"},"_hasShrinkwrap":false,"devDependencies":{"supertest":"^6.3.4","@types/uuid":"^9.0.8","@2amtech/crudx":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/crudx-swagger_1.0.3_1736308228931_0.3908923631242547","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@2amtech/crudx-swagger","author":{"name":"Antonio Ramirez Cobos","email":"hola@2amigos.us","url":"https://2am.tech/"},"repository":{"url":"git+https://github.com/2amigos/nest-kit.git"},"contributors":[{"name":"Jonatas Souza","email":"hola@2amigos.us"},{"name":"Aleksandar Panic","email":"hola@2amigos.us"}],"description":"NestJs package to apply swagger meta-data into routes generated with @2amtech/crudx package","version":"1.0.4","dependencies":{"tslib":"^2.3.0","@2amtech/crudx":"1.0.0","@nestjs/common":"^10.1.3","@nestjs/swagger":"^7.1.6","lodash":"^4.17.21"},"devDependencies":{"supertest":"^6.3.4","@types/uuid":"^9.0.8","@2amtech/crudx":"1.0.0"},"keywords":["typescript","nest","nestjs","api","crud","swagger-docs","docs"],"type":"commonjs","main":"./src/index.js","typings":"./src/index.d.ts","types":"./src/index.d.ts","_id":"@2amtech/crudx-swagger@1.0.4","gitHead":"e18c5673ec1bbb5bc60dd1bbc53f080292cf7465","bugs":{"url":"https://github.com/2amigos/nest-kit/issues"},"homepage":"https://github.com/2amigos/nest-kit#readme","_nodeVersion":"18.20.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-QeFioONxd4uipf2nXAXf0oKJ7dLfIsXe3AQcR18NWMhL1Tt3b1Bef+IWfJC6XNpIKtnfnMx9JrEKU82w9i1x4Q==","shasum":"e6397c1bfac584d1d18c3224599c52b945d151c1","tarball":"https://registry.npmjs.org/@2amtech/crudx-swagger/-/crudx-swagger-1.0.4.tgz","fileCount":18,"unpackedSize":42273,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@2amtech%2fcrudx-swagger@1.0.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/LocDU+JBYO4pJzT5OoKIDD5Ca6q+tepJxAPOLNto9gIhAPppEEievUDoEeKWC4Sr39rnNVDlKJy/AO5B6hHNNpWr"}]},"_npmUser":{"name":"2amtech","email":"accounts@2am.tech"},"directories":{},"maintainers":[{"name":"2amtech","email":"accounts@2am.tech"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/crudx-swagger_1.0.4_1736311258301_0.28251584743034686"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-05T14:58:05.548Z","modified":"2025-01-08T04:40:58.827Z","1.0.0":"2024-08-05T14:58:05.884Z","1.0.1":"2024-08-22T10:41:59.837Z","1.0.3":"2025-01-08T03:50:29.109Z","1.0.4":"2025-01-08T04:40:58.485Z"},"bugs":{"url":"https://github.com/2amigos/nest-kit/issues"},"author":{"name":"Antonio Ramirez Cobos","email":"hola@2amigos.us","url":"https://2am.tech/"},"homepage":"https://github.com/2amigos/nest-kit#readme","keywords":["typescript","nest","nestjs","api","crud","swagger-docs","docs"],"repository":{"url":"git+https://github.com/2amigos/nest-kit.git"},"description":"NestJs package to apply swagger meta-data into routes generated with @2amtech/crudx package","contributors":[{"name":"Jonatas Souza","email":"hola@2amigos.us"},{"name":"Aleksandar Panic","email":"hola@2amigos.us"}],"maintainers":[{"name":"2amtech","email":"accounts@2am.tech"}],"readme":"# @2amtech/crudx-swagger\n\nNestJS provides great support to swagger through its package [@nestjs/swagger](https://docs.nestjs.com/openapi/introduction).\n\nAs a library built to empower the CRUD endpoints creation, the `@2amtech/crudx` fulfills this step proving the `@2amtech/crudx-swagger`, a handy one-step setup module to add relevant meta-data for the auto-generated endpoints CRUD endpoints.\n\nWith this package, you will have defined default descriptions in your swagger docs for all your CRUD routes, being able to replace/extend them, by simply overriding the desired route, and adding your own description using the `@nestjs/swagger` decorators.\n\n## Install\n\n```bash\n$ npm i @2amtech/crudx-swagger\n```\n\n## Configure\n\nTo configure the package, you will only have to set the `CrudxSwaggerRoutesFactory` to the `routesFactory` option into your application Global Option:\n\n```typescript\nimport { CrudConfigService } from \"@2amtech/crudx\";\nimport { NestFactory } from \"@nestjs/core\";\nimport { CrudxSwaggerRoutesFactory } from \"@2amtech/crudx-swagger\"\n\nCrudConfigService.load({\n  ...\n  routesFactory: CrudxSwaggerRoutesFactory,\n});\n\nimport { AppModule } from \"./app/app.module\";\n...\n```\n\nThen, you have to create a swagger document and the app itself, as it's usually done:\n\n```typescript\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n  const globalPrefix = \"api\";\n  app.setGlobalPrefix(globalPrefix);\n\n  const port = process.env.PORT || 3000;\n\n  const config = new DocumentBuilder().setTitle(\"Crudx Swagger\").setDescription(\"Crudx-Swagger\").setVersion(\"1.0\").addTag(\"crudx-swagger\").build();\n  const document = SwaggerModule.createDocument(app, config);\n  SwaggerModule.setup(\"api/docs\", app, document);\n\n  await app.listen(port);\n}\n\nbootstrap();\n```\n\n## Overring docs\n\nIf you want to change the default docs or update some route docs with your own description, all you have to do is override the route, and then apply your decorators:\n\n```typescript\n...\n\n@Crud({\n  model: {\n    type: User,\n  },\n})\n@Controller('/user')\nexport class UserController implements CrudController<User> {\n  constructor(public service: UserService) {}\n\n  get base(): CrudController<User> {\n    return this;\n  }\n\n  @Override()\n  @ApiResponse(<ApiResponseOptions>{\n    status: 200,\n    description: \"Overriden description\",\n  })\n  async getOne(req: CrudRequest): Promise<User> {\n      return this.base.getOneBase(req);\n  }\n}\n```\n\n<blockquote>\n    <a href=\"http://www.2amigos.us\"><img src=\"http://www.gravatar.com/avatar/55363394d72945ff7ed312556ec041e0.png\"></a><br>\n    <i>web development has never been so fun</i><br> \n    <a href=\"http://www.2amigos.us\">www.2am.tech</a>\n</blockquote>\n","readmeFilename":"README.md"}