{"_id":"@chax-at/swagger-helpers-nest","_rev":"5-8935fc8b08a6589bb0029e69649760f4","name":"@chax-at/swagger-helpers-nest","dist-tags":{"latest":"0.3.1"},"versions":{"0.1.0":{"name":"@chax-at/swagger-helpers-nest","version":"0.1.0","author":{"name":"chax.at - Challenge Accepted"},"license":"MIT","_id":"@chax-at/swagger-helpers-nest@0.1.0","maintainers":[{"name":"jan-chax","email":"jan.muratha@chax.at"},{"name":"chartinger","email":"c.k.hartinger@gmail.com"},{"name":"simonjimenez","email":"simon@chax.at"},{"name":"valerionn","email":"mattis@chax.at"}],"homepage":"https://github.com/chax-at/swagger-helpers-nest#readme","bugs":{"url":"https://github.com/chax-at/swagger-helpers-nest/issues"},"dist":{"shasum":"87bdb9801aa448183ff36539bc3d8a80fd0192c2","tarball":"https://registry.npmjs.org/@chax-at/swagger-helpers-nest/-/swagger-helpers-nest-0.1.0.tgz","fileCount":7,"integrity":"sha512-f1FDlRyCNIjlTfAE91brKAynLNNs7hcFETmzZpIbuf9svoKn0si7pyzGKcwjR8d+cOi31gDkqVa0tTCNlukdXw==","signatures":[{"sig":"MEUCIQC+82WxOvVebrUduLQw9NRAtdF6wkQI6bte8RGZc+1pCQIgZqrIUPNwUAZrIAb37K2dKeWcb7PwmXLEJCDKiSK9unM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10866},"main":"lib/index.js","engines":{"node":">= 18"},"gitHead":"38509a1ae8f38dae371f6a948fd6be28b7f6a06a","scripts":{"test":"jest --maxWorkers=50%","build":"tsc","prepare":"npm run build","prettier:write":"prettier \"{src,tests}/**/*.ts\" --write"},"typings":"lib/index.d.ts","_npmUser":{"name":"valerionn","email":"mattis@chax.at"},"repository":{"url":"git+https://github.com/chax-at/swagger-helpers-nest.git","type":"git"},"_npmVersion":"10.9.0","description":"A set of tools and decorators to have an easier time generating OpenAPI (swagger) docs with @nestjs/swagger","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","prettier":"3.3.2","@swc/core":"^1.3.64","@swc/jest":"^0.2.26","typescript":"^5.1.3","@types/jest":"^29.5.2","@types/node":"^18.15.3"},"peerDependencies":{"@nestjs/common":"6 - 11","@nestjs/swagger":"7 - 11"},"_npmOperationalInternal":{"tmp":"tmp/swagger-helpers-nest_0.1.0_1740661223225_0.7131250476062481","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@chax-at/swagger-helpers-nest","version":"0.2.0","author":{"name":"chax.at - Challenge Accepted"},"license":"MIT","_id":"@chax-at/swagger-helpers-nest@0.2.0","maintainers":[{"name":"jan-chax","email":"jan.muratha@chax.at"},{"name":"chartinger","email":"c.k.hartinger@gmail.com"},{"name":"simonjimenez","email":"simon@chax.at"},{"name":"valerionn","email":"mattis@chax.at"}],"homepage":"https://github.com/chax-at/swagger-helpers-nest#readme","bugs":{"url":"https://github.com/chax-at/swagger-helpers-nest/issues"},"dist":{"shasum":"957cfcea192461c3cfd4cda4bb987fd0b98f39cc","tarball":"https://registry.npmjs.org/@chax-at/swagger-helpers-nest/-/swagger-helpers-nest-0.2.0.tgz","fileCount":11,"integrity":"sha512-ca+a3ahWMUzsL/nMfSxsUDS6OHMRPOBXlU2/lZh/dSgIph65RW6/MbebCZ79WrKyKGWE1cBGBhSEfK2P6e55rw==","signatures":[{"sig":"MEYCIQCpmMXa8HdFjJqyqu+TSILMb6MSLPsh2Xw0hRQ9mHE/NQIhAOz99Vg2k9K21zKsCasZ/gPXmQCT7XERqBZap1oQdppm","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16525},"main":"lib/index.js","engines":{"node":">= 18"},"gitHead":"4d38dafaa532ab7e4e7a71fd22e0ac730764f0a7","scripts":{"test":"jest --maxWorkers=50%","build":"tsc","prepare":"npm run build","prettier:write":"prettier \"{src,tests}/**/*.ts\" --write"},"typings":"lib/index.d.ts","_npmUser":{"name":"valerionn","email":"mattis@chax.at"},"repository":{"url":"git+https://github.com/chax-at/swagger-helpers-nest.git","type":"git"},"_npmVersion":"10.9.0","description":"A set of tools and decorators to have an easier time generating OpenAPI (swagger) docs with @nestjs/swagger","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","prettier":"3.3.2","@swc/core":"^1.3.64","@swc/jest":"^0.2.26","typescript":"^5.1.3","@types/jest":"^29.5.2","@types/node":"^18.15.3"},"peerDependencies":{"@nestjs/common":"6 - 11","@nestjs/swagger":"7 - 11"},"_npmOperationalInternal":{"tmp":"tmp/swagger-helpers-nest_0.2.0_1743411475568_0.6021443587077411","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@chax-at/swagger-helpers-nest","version":"0.3.0","author":{"name":"chax.at - Challenge Accepted"},"license":"MIT","_id":"@chax-at/swagger-helpers-nest@0.3.0","maintainers":[{"name":"jan-chax","email":"jan.muratha@chax.at"},{"name":"chartinger","email":"c.k.hartinger@gmail.com"},{"name":"simonjimenez","email":"simon@chax.at"},{"name":"valerionn","email":"mattis@chax.at"}],"homepage":"https://github.com/chax-at/swagger-helpers-nest#readme","bugs":{"url":"https://github.com/chax-at/swagger-helpers-nest/issues"},"dist":{"shasum":"6f8b3c9a68569de880f129e12d7e4b6804b0f4fa","tarball":"https://registry.npmjs.org/@chax-at/swagger-helpers-nest/-/swagger-helpers-nest-0.3.0.tgz","fileCount":13,"integrity":"sha512-gc15c33fjU9mDEp+Cq0E9lGtp0AcZQwchQnmTBEbRi/RzK2wfw2Z8f/Pnb4D1uEcE0TrA8N585J8dqlX3fDMWg==","signatures":[{"sig":"MEUCID7ckncFQ7I3DQqNTSQo4/o8UIUWX8cblhMPacenHRZXAiEAgOeN/4JEldFOHDcPmi/HpyaY3GwJW9FYQllbw2Ru6II=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@chax-at%2fswagger-helpers-nest@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":20867},"main":"lib/index.js","engines":{"node":">= 18"},"gitHead":"0c319c62f05c01cf945fb64624e5d396a2e8bf8b","scripts":{"test":"jest --maxWorkers=50%","build":"tsc","prepare":"npm run build","prettier:write":"prettier \"{src,tests}/**/*.ts\" --write"},"typings":"lib/index.d.ts","_npmUser":{"name":"valerionn","email":"mattis@chax.at"},"repository":{"url":"git+https://github.com/chax-at/swagger-helpers-nest.git","type":"git"},"_npmVersion":"10.9.2","description":"A set of tools and decorators to have an easier time generating OpenAPI (swagger) docs with @nestjs/swagger","directories":{},"_nodeVersion":"22.15.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","prettier":"3.3.2","@swc/core":"^1.3.64","@swc/jest":"^0.2.26","typescript":"^5.1.3","@types/jest":"^29.5.2","@types/node":"^18.15.3"},"peerDependencies":{"@nestjs/common":"6 - 11","@nestjs/swagger":"7 - 11"},"_npmOperationalInternal":{"tmp":"tmp/swagger-helpers-nest_0.3.0_1748430486235_0.611239008332443","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@chax-at/swagger-helpers-nest","version":"0.3.1","author":{"name":"chax.at - Challenge Accepted"},"license":"MIT","_id":"@chax-at/swagger-helpers-nest@0.3.1","maintainers":[{"name":"jan-chax","email":"jan.muratha@chax.at"},{"name":"chartinger","email":"c.k.hartinger@gmail.com"},{"name":"simonjimenez","email":"simon@chax.at"},{"name":"valerionn","email":"mattis@chax.at"}],"homepage":"https://github.com/chax-at/swagger-helpers-nest#readme","bugs":{"url":"https://github.com/chax-at/swagger-helpers-nest/issues"},"dist":{"shasum":"f5c870b527908a34051b840d18ca8bbfd26e997e","tarball":"https://registry.npmjs.org/@chax-at/swagger-helpers-nest/-/swagger-helpers-nest-0.3.1.tgz","fileCount":13,"integrity":"sha512-S0oNRyp5/pFf3GOyDoCRksvCvklBh0bh2me9vX4+dMdbPb42M2Nkp9UMtPE0B3grgyTO1PUH7vp+4odvC9jnvw==","signatures":[{"sig":"MEUCICj5fOLXrXwPSOhS4qxsahaw15O3JinEecQ41ynNk/KbAiEA0/OGtnyOXv2Wm4VhCP+X+282NWlA5oNiBvXGwu/y65E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@chax-at%2fswagger-helpers-nest@0.3.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":20871},"main":"lib/index.js","engines":{"node":">= 18"},"gitHead":"172f4544a598a5c5520509d512eb707f36250b93","scripts":{"test":"jest --maxWorkers=50%","build":"tsc","prepare":"npm run build","prettier:write":"prettier \"{src,tests}/**/*.ts\" --write"},"typings":"lib/index.d.ts","_npmUser":{"name":"valerionn","email":"mattis@chax.at"},"repository":{"url":"git+https://github.com/chax-at/swagger-helpers-nest.git","type":"git"},"_npmVersion":"10.9.2","description":"A set of tools and decorators to have an easier time generating OpenAPI (swagger) docs with @nestjs/swagger","directories":{},"_nodeVersion":"22.15.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","prettier":"3.3.2","@swc/core":"^1.3.64","@swc/jest":"^0.2.26","typescript":"^5.1.3","@types/jest":"^29.5.2","@types/node":"^18.15.3"},"peerDependencies":{"@nestjs/common":"6 - 11","@nestjs/swagger":"7 - 11"},"_npmOperationalInternal":{"tmp":"tmp/swagger-helpers-nest_0.3.1_1748432384003_0.8755522474354747","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-02-27T13:00:23.144Z","modified":"2025-09-24T11:13:27.170Z","0.1.0":"2025-02-27T13:00:23.410Z","0.2.0":"2025-03-31T08:57:55.737Z","0.3.0":"2025-05-28T11:08:06.441Z","0.3.1":"2025-05-28T11:39:44.183Z"},"bugs":{"url":"https://github.com/chax-at/swagger-helpers-nest/issues"},"author":{"name":"chax.at - Challenge Accepted"},"license":"MIT","homepage":"https://github.com/chax-at/swagger-helpers-nest#readme","repository":{"url":"git+https://github.com/chax-at/swagger-helpers-nest.git","type":"git"},"description":"A set of tools and decorators to have an easier time generating OpenAPI (swagger) docs with @nestjs/swagger","maintainers":[{"email":"c.k.hartinger@gmail.com","name":"chartinger"},{"email":"simon@chax.at","name":"simonjimenez"},{"email":"mattis@chax.at","name":"valerionn"}],"readme":"# @chax-at/swagger-helpers-nest\n\nThis package provides additional tools to make generating <a href=\"https://swagger.io/specification/\">OpenAPI</a> documentations with <a href=\"https://github.com/nestjs/swagger\">NestJS/Swagger</a> easier.\n\n## Usage\n\n### Prerequisites\n\nFirst, install the package by running\n\n```\nnpm i @chax-at/swagger-helpers-nest\n```\n\n### Decorators\n\nTo have a better time generating useful OpenAPI (swagger) doc files, this package provides a set of decorators that combine @nestjs/swagger decorators.\n\nHere are some examples.\n\n#### DTO properties\n\n```ts\nclass MugResponse {\n  // if a property can have one of multiple types, use\n  @ApiPropertyOneOf(TeaDto, CoffeeDto)\n  public contents!: TeaDto | CoffeeDto;\n}\n\nclass CarResponse {\n  // if a property is an array of one or more non-primitive types, use\n  @ApiPropertyArrayOf(WheelDto)\n  public wheels!: WheelDto[];\n}\n\nclass SuccessResponse {\n  // if a property must be one specific value rather than a type, use\n  @ApiPropertyOfValue(true)\n  public success!: true;\n}\n\nclass StatusResponse {\n  // if a property's value is an enum, use the following to export the enum itself into the docs too\n  @ApiPropertyEnum({ Status })\n  public status!: Status;\n}\n```\n\n#### Responses\n\n```ts\nclass DrinksController {\n  @Get()\n  // if a route can have one of multiple response types, use\n  @ApiResponseOneOf([TeaResponse, CoffeeResponse])\n  public getDrink(): Promise<TeaResponse | CoffeeResponse> {\n    return this.drinkService.getDrinkResponse();\n  }\n\n  @Post()\n  // if a route can have one of multiple response types and the status should be 201, use\n  @ApiCreatedResponseOneOf([TeaResponse, CoffeeResponse])\n  public createDrink(): Promise<TeaResponse | CoffeeResponse> {\n    return this.drinkService.createDrink();\n  }\n}\n```\n\n### Post processing\n\nSometimes decorators just don't cut it and you want to make alterations after `@nestjs/swagger`'s\n`buildSwaggerDocument()` is done.\n\nFor this, this package provides a traversal utility `traverseDocument` which can be configured with visitors.\n\nExample:\n\n```ts\nconst MyVisitor: SchemaVisitor = (schema) => {\n  if (matchesSomeCondition(schema)) {\n    // modify schema in place\n  }\n};\n\nconst document = buildSwaggerDocument(app);\ntraverseDocument(document, {\n  propertyVisitors: [\n    Length1AllOfToOneOfVisitor, // convert allOf's with one entry to oneOf's\n    MoveNullableToOneOfVisitor, // move a nullable:true into a sibling oneOf\n    MyVisitor, // your own\n  ],\n  operationVisitors: [\n    // an example visitor that adds an operation's method as a tag\n    (op, method) => {\n      op.tags.push(method);\n    },\n    // an example visitor that removes operations based on a tag\n    (op) => {\n      if (op.tags?.include('DoNotExpose')) {\n        return 'delete';\n      }\n    },\n  ],\n});\n```\n","readmeFilename":"README.md"}