{"_id":"@abbas_srour/nest-openapi-tools","name":"@abbas_srour/nest-openapi-tools","dist-tags":{"latest":"6.0.7"},"versions":{"6.0.7":{"name":"@abbas_srour/nest-openapi-tools","publishConfig":{"access":"public"},"description":"A collection of tools to make building and deploying AWS serverless Nest applications AWESOME.","author":{"name":"Kerry Ritter","email":"ritter@kerryritter.com","url":"http://www.kerryritter.com"},"license":"MIT","scripts":{"prebuild":"rimraf dist","build":"nest build","format":"prettier --write \"src/**/*.ts\"","start":"nest start","start:dev":"nest start --watch","start:debug":"nest start --debug --watch","start:prod":"node dist/main","lint":"eslint \"{src,apps,libs,test}/**/*.ts\" --fix","test":"jest","test:watch":"jest --watch","test:cov":"jest --coverage","test:debug":"node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand","test:e2e":"jest --config ./test/jest-e2e.json","release":"npm run build && npm publish"},"main":"dist/index.js","types":"dist/index.d.ts","peerDependencies":{"@nestjs/common":"10 - 11","@nestjs/core":"10 - 11","@nestjs/platform-express":"10 - 11","@nestjs/swagger":"8 - 11","swagger-ui-express":"^5.0.0"},"devDependencies":{"@nestjs/cli":"^10.0.0","@nestjs/common":"^10.0.0","@nestjs/core":"^10.0.0","@nestjs/platform-express":"^10.0.0","@nestjs/schematics":"^10.0.0","@nestjs/swagger":"^8.0.0","@nestjs/testing":"^10.0.0","@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@types/jest":"29.5.5","@types/node":"^20.8.4","@types/rimraf":"^3.0.2","@types/supertest":"^2.0.14","@typescript-eslint/eslint-plugin":"6.7.5","@typescript-eslint/parser":"6.7.5","eslint":"8.51.0","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.28.1","jest":"29.7.0","prettier":"^3.0.3","reflect-metadata":"^0.1.13","rimraf":"^5.0.10","semantic-release":"^22.0.5","supertest":"^6.3.3","swagger-ui-express":"^5.0.0","ts-jest":"29.1.1","ts-loader":"^9.5.0","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typescript":"^5.2.2","webpack":"^5.88.2","yaml":"^2.3.2"},"repository":{"type":"git","url":"git+https://github.com/BeerMoneyDev/nest-openapi-tools.git"},"release":{"branch":"master","plugins":[["@semantic-release/commit-analyzer",{"preset":"angular","releaseRules":[{"type":"docs","scope":"README","release":"patch"},{"type":"refactor","release":"patch"},{"type":"feature","release":"patch"},{"type":"chore","release":"patch"},{"type":"style","release":"patch"},{"type":"breaking","release":"major"}],"parserOpts":{"noteKeywords":["BREAKING CHANGE","BREAKING CHANGES"]}}],"@semantic-release/release-notes-generator",["@semantic-release/changelog",{"changelogFile":"CHANGELOG.md"}],["@semantic-release/npm",{"npmPublish":true,"tarballDir":"dist"}],["@semantic-release/git",{"assets":["package.json","package-lock.json","CHANGELOG.md"],"message":"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"}],["@semantic-release/github",{"assets":"dist/*.tgz"}]]},"jest":{"moduleFileExtensions":["js","json","ts"],"rootDir":"src","testRegex":".spec.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"coverageDirectory":"../coverage","testEnvironment":"node"},"version":"6.0.7","dependencies":{"@openapitools/openapi-generator-cli":"^2.7.0"},"_id":"@abbas_srour/nest-openapi-tools@6.0.7","gitHead":"40e812dcd6ab489f9c05861f08242af31a0ef8ca","bugs":{"url":"https://github.com/BeerMoneyDev/nest-openapi-tools/issues"},"homepage":"https://github.com/BeerMoneyDev/nest-openapi-tools#readme","_nodeVersion":"24.1.0","_npmVersion":"10.2.0","dist":{"integrity":"sha512-wHqmzVKbPZbRQMsGTNHuIDlWNarPBuPbx4fzajwsHAOwOfe5L5nQtJSeNowTZUZO1oMmYeHPW+9TLV3p85e+Sw==","shasum":"f8966503298f8553d5bc42ee5208363c9fd9a2e0","tarball":"https://registry.npmjs.org/@abbas_srour/nest-openapi-tools/-/nest-openapi-tools-6.0.7.tgz","fileCount":27,"unpackedSize":166563,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDCksJPGKuU9LVI0+pQtNFTIM7Q3r5qiVFefKT4fSVtjQIhAJSWOVcffvJHF2x3cqFzCwW82EETxTDoMUF46K7Aq/k/"}]},"_npmUser":{"name":"abbas_srour","email":"abbas.mj.srour@gmail.com"},"directories":{},"maintainers":[{"name":"abbas_srour","email":"abbas.mj.srour@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nest-openapi-tools_6.0.7_1767531194203_0.2075100477789773"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-04T12:53:14.108Z","6.0.7":"2026-01-04T12:53:14.342Z","modified":"2026-01-04T12:53:14.663Z"},"maintainers":[{"name":"abbas_srour","email":"abbas.mj.srour@gmail.com"}],"description":"A collection of tools to make building and deploying AWS serverless Nest applications AWESOME.","homepage":"https://github.com/BeerMoneyDev/nest-openapi-tools#readme","repository":{"type":"git","url":"git+https://github.com/BeerMoneyDev/nest-openapi-tools.git"},"author":{"name":"Kerry Ritter","email":"ritter@kerryritter.com","url":"http://www.kerryritter.com"},"bugs":{"url":"https://github.com/BeerMoneyDev/nest-openapi-tools/issues"},"license":"MIT","readme":"<h1 align=\"center\">nest-openapi-tools</h1>\n<div align=\"center\">\n  <img src=\"https://beermoneydev-assets.s3.amazonaws.com/nest-openapi-tools-logo.png\" />\n</div>\n<br />\n<div align=\"center\">\n  <strong>Easily integrate Swagger/OpenAPI with NestJS APIs.</strong>\n</div>\n<br />\n<div align=\"center\">\n<a href=\"https://www.npmjs.com/package/nest-openapi-tools\"><img src=\"https://img.shields.io/npm/v/nest-openapi-tools.svg\" alt=\"NPM Version\" /></a>\n<a href=\"https://www.npmjs.com/package/nest-openapi-tools\"><img src=\"https://img.shields.io/npm/l/nest-openapi-tools.svg\" alt=\"Package License\" /></a>\n<a href=\"https://www.npmjs.com/package/nest-openapi-tools\"><img src=\"https://img.shields.io/npm/dm/nest-openapi-tools.svg\" alt=\"NPM Downloads\" /></a>\n</div>\n\n# Installation\n\n```bash\nnpm install --save nest-openapi-tools @nestjs/swagger swagger-ui-express\n```\n\n# About\n\nThis library's goal is to make it as easy as possible to use NestJS with Swagger, also known as OpenAPI. NestJS's Swagger package does not currently generate specification file - rather, it generates the web server with the specification.\n\nThis package leverages that tooling to generate a YAML or JSON specification file as well as `@openapitools/openapi-generator-cli` to then generate a client. By using this as part of our development experience, we can build our APIs with NestJS's `npm run start:dev` running and have a new, fully-setup API client ready to go for our consuming layer (whether this is a SPA app or another API service).\n\n# Usage\n\n## Setting up API Definitions in NestJS\n\nThe [NestJS OpenAPI docs for @NestJS/Swagger](https://docs.nestjs.com/openapi/introduction) are a fantastic guide to defining your API in code. There are two routes:\n\n1. Using the [CLI Plugin](https://docs.nestjs.com/openapi/cli-plugin). This is recommended as it is very hands-off and easy-to-use. However, it is a bit of a \"magic\" solution - this can sometimes prove frustrating.\n2. Use decorators for [operations](https://docs.nestjs.com/openapi/operations) and [types](https://docs.nestjs.com/openapi/types-and-parameters). This is more hands-on but is concise in what is expected to be produced.\n\nThese must be complete in order for Nest OpenAPI Tools to function - this package leverages the NestJS Swagger library to generate the server and specification file. \n\n## OpenApiNestFactory\n\nThe OpenApiNestFactory simplifies the process of:\n\n1. Generating an OpenAPI file from a NestJS API.\n2. Generating a client project (i.e. an Axios client or an Angular client module).\n3. Starting up the OpenAPI documentation web server.\n\n### How to use\n\nTo leverage this functionality, add a call to `OpenApiNestFactory.configure()` call as demonstrated below.\n\n```ts\n// main.ts - BEFORE\nimport { NestFactory } from '@nestjs/core';\nimport { AppModule } from './app.module';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n  await app.listen(3000);\n}\nbootstrap();\n```\n\n```ts\n// main.ts - AFTER\nimport { NestFactory } from '@nestjs/core';\nimport { AppModule } from './app.module';\nimport { OpenApiNestFactory } from 'nest-openapi-tools';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n\n  await OpenApiNestFactory.configure(\n    app, \n    new DocumentBuilder().setTitle('My API'),\n  );\n\n  await app.listen(3000);\n}\nbootstrap();\n```\n\nThis falls back to all defaults provided by Nest OpenAPI Tools to:\n\n* enable the documentation web server at http://localhost:3000/api-docs\n* generate the OpenAPI document at `./openapi.yaml`\n* generate a TypeScript Axios HTTP client at `../my-api-client`.\n\nNote that all of these values can be changed as demonstrated in the section below.\n\n### OpenApiNestFactory configuration\n\nThese are the default values when no options are passed in to OpenApiNestFactory. To override these, simply use the configuration object (the third argument in the `configure()` call).\n\n```ts\n// main.ts\nimport { NestFactory } from '@nestjs/core';\nimport { AppModule } from './app.module';\nimport { OpenApiNestFactory } from 'nest-openapi-tools';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n\n  await OpenApiNestFactory.configure(app, \n    new DocumentBuilder()\n      .setTitle('My API')\n      .setDescription('An API to do awesome things')\n      .addBearerAuth(),\n    {\n      webServerOptions: {\n        enabled: true,\n        path: 'api-docs',\n      },\n      fileGeneratorOptions: {\n        enabled: true,\n        outputFilePath: './openapi.yaml',  // or ./openapi.json\n      },\n      clientGeneratorOptions: {\n        enabled: true,\n        type: 'typescript-axios',\n        outputFolderPath: '../typescript-api-client/src',\n        additionalProperties:\n          'apiPackage=clients,modelPackage=models,withoutPrefixEnums=true,withSeparateModelsAndApi=true',\n        openApiFilePath: './openapi.yaml', // or ./openapi.json\n        skipValidation: true, // optional, false by default\n      },\n    }, {\n    operationIdFactory: (c: string, method: string) => method,\n  });\n\n  await app.listen(3000);\n}\nbootstrap();\n```\n\n***NOTICE!* File generation and client generation should be disabled in production as they are costly to startup time.**\n\n### Client Generator Options\n\nThis project leverages the [OpenAPITools/openapi-generator](https://github.com/OpenAPITools/openapi-generator) project via the npm package, `@openapitools/openapi-generator-cli` which is required to be installed globally. Accordingly, any client generators and configuration supported by this project are usable via Nest OpenAPI Tools.\n\n#### Client Generator Classes\n\nTo help with getting started, Nest OpenAPI Tools provides some classes with helpful defaults.\n\n**AxiosClientGeneratorOptions**\n\n* type = 'typescript-axios';\n* outputFolderPath = '../typescript-api-client/src';\n* additionalProperties = 'apiPackage=clients,modelPackage=models,withoutPrefixEnums=true,withSeparateModelsAndApi=true';\n* openApiFilePath = './openapi.yaml';\n\n# Stay in touch\n\nAuthor - Kerry Ritter, BeerMoneyDev\n\nWebsite - https://www.kerryritter.com/, https://www.beermoney.dev/","readmeFilename":"README.md","_rev":"1-c89187eecc29f204d6c98ab68524fccc"}