{"id":20641850,"url":"https://github.com/ssukienn/nestjs-swagger-api-spec","last_synced_at":"2026-03-05T15:32:25.225Z","repository":{"id":199507828,"uuid":"702131816","full_name":"ssukienn/nestjs-swagger-api-spec","owner":"ssukienn","description":"Decorator for aggregating all your @nestjs/swagger decorators.","archived":false,"fork":false,"pushed_at":"2025-03-24T19:20:40.000Z","size":427,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T03:32:08.454Z","etag":null,"topics":["decorator","nestjs","openapi","swagger","typescript","utility"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nestjs-swagger-api-spec","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ssukienn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-08T15:34:14.000Z","updated_at":"2025-01-20T23:00:44.000Z","dependencies_parsed_at":"2024-11-15T04:04:02.397Z","dependency_job_id":"dfd2b7e2-0b81-424e-8f01-55de4a23084d","html_url":"https://github.com/ssukienn/nestjs-swagger-api-spec","commit_stats":null,"previous_names":["ssukienn/nestjs-swagger-api-spec"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssukienn%2Fnestjs-swagger-api-spec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssukienn%2Fnestjs-swagger-api-spec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssukienn%2Fnestjs-swagger-api-spec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssukienn%2Fnestjs-swagger-api-spec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssukienn","download_url":"https://codeload.github.com/ssukienn/nestjs-swagger-api-spec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249182783,"owners_count":21226123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decorator","nestjs","openapi","swagger","typescript","utility"],"created_at":"2024-11-16T16:06:58.238Z","updated_at":"2026-03-05T15:32:25.191Z","avatar_url":"https://github.com/ssukienn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Motivation\n===\n\nSimplify the management of `@Controller` classes and methods (e.g., `@Get` route handler) by addressing the issue of OpenAPI decorators pollution from `@nestjs/swagger`. This library provides a streamlined approach to apply all relevant OpenAPI decorators using a single decorator.\n\n## Requirements\n\n* minimal `@nestjs/common@^10`\n* minimal `@nestjs/swagger@^7`\n\nFor specific version details, refer to `package.json`.\n\n\n## Usage\n\n### 1. Install the Dependency\n\n```\n$ npm install nestjs-swagger-api-spec\n```\n\n### 2. Use `@ApiSpecification` Decorator\n\nApply the `@ApiSpecification` decorator to controllers or handlers to automatically add relevant `@Api\u003cname\u003e` decorators. Decorator order is determined by ECMAScript iteration order for keys and can be adjusted using order suffixes.\n\n\n### Example\n```typescript\nimport { ApiSpecification, ApiOptions } from 'nestjs-swagger-api-spec';\n\nconst exampleSpec: ApiOptions = {\n    apiResponseOptions: (apiDecorator) =\u003e apiDecorator({ status: 200, description: \"Applied in the middle, defined first.\" }),\n    apiOperationOptions1: (apiDecorator) =\u003e [\n        apiDecorator({\n            summary: \"title\",\n            description: \"3\",\n        }),\n        apiDecorator({ summary: \"title\", description: \"Applied last, defined in the middle.\" }),\n    ],\n    'apiOperationOptions-1': (apiDecorator) =\u003e apiDecorator({ status: 200, description: \"Applied first, defined last.\" },\n    //...\n}\n\n@ApiSpecification(exampleSpec)\n@Controller()\nclass Example {\n    \n    @Get()\n    @ApiSpecification({\n        apiOperationOptions1: (apiDecorator) =\u003e apiDecorator({\n            summary: \"customTitle\",\n            description: \"customDescription\",\n        }),\n        // Additional decorators...\n    })\n    getExample() {\n        //...\n    }\n}\n```\n\n### Decorator Ordering\n\nThe order of decorators can be customized by adding a suffix number to the options properties. Positive numbers define the order in ascending fashion, while negative numbers represent the order in descending fashion. For instance, `apiOperationOptions1` and `'apiOperationOptions-1'` will apply decorators in different orders. Default order is `0`.\n\n## Caveats\n\n* Decorator factories must be named with the Api prefix.\n* Using property names with a format other than expected may result in errors.\n* `ApiProperty`, `ApiPropertyOptional`, and `ApiHideProperty` decorators are not supported for route handler decorators.\n* Future Nest versions breaking the contract of applyDecorators may impact the implementation.\n\n## Getting Support \u0026 Contributing\n\n* Open issues or pull requests for support or contributions.\n\n## License\n\n- [MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssukienn%2Fnestjs-swagger-api-spec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssukienn%2Fnestjs-swagger-api-spec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssukienn%2Fnestjs-swagger-api-spec/lists"}