Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nanogiants/nestjs-swagger-api-exception-decorator
NestJS Swagger decorator for API exceptions
https://github.com/nanogiants/nestjs-swagger-api-exception-decorator
Last synced: 8 days ago
JSON representation
NestJS Swagger decorator for API exceptions
- Host: GitHub
- URL: https://github.com/nanogiants/nestjs-swagger-api-exception-decorator
- Owner: nanogiants
- License: mit
- Created: 2020-04-20T08:20:21.000Z (over 4 years ago)
- Default Branch: develop
- Last Pushed: 2023-10-19T12:23:11.000Z (about 1 year ago)
- Last Synced: 2024-09-19T22:52:59.301Z (2 months ago)
- Language: TypeScript
- Size: 3.81 MB
- Stars: 36
- Watchers: 7
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NestJS Swagger API Exception Decorator
[![Node.js CI](https://github.com/nanogiants/nestjs-swagger-api-exception-decorator/workflows/Node.js%20CI/badge.svg?branch=master)](https://github.com/nanogiants/nestjs-swagger-api-exception-decorator/workflows/Node.js%20CI)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanogiants_nestjs-swagger-api-exception-decorator&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanogiants_nestjs-swagger-api-exception-decorator)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=nanogiants_nestjs-swagger-api-exception-decorator&metric=coverage)](https://sonarcloud.io/dashboard?id=nanogiants_nestjs-swagger-api-exception-decorator)
[![npm](https://img.shields.io/npm/v/@nanogiants/nestjs-swagger-api-exception-decorator)](https://www.npmjs.com/package/@nanogiants/nestjs-swagger-api-exception-decorator)
[![npm downloads](https://img.shields.io/npm/dw/@nanogiants/nestjs-swagger-api-exception-decorator)](https://www.npmjs.com/package/@nanogiants/nestjs-swagger-api-exception-decorator)## Description
[NestJS Swagger](https://docs.nestjs.com/openapi/introduction) decorator for API exceptions.
## Installation
```sh
$ npm i @nanogiants/nestjs-swagger-api-exception-decorator
```## Example
```typescript
import { ApiException } from '@nanogiants/nestjs-swagger-api-exception-decorator';@ApiException(() => UnauthorizedException)
export class Controller {
@ApiOperation({ summary: 'Changes the users password' })
@ApiException(() => [PasswordsDidNotMatchException, OldAndNewPasswordMatchException, CredentialsNotValidException])
@Patch('/password')
async changeUserPassword(@Res() res: Response): Promise {
return res.sendStatus(HttpStatus.OK);
}
}
```## Getting Started
Please visit our [documentation](https://nanogiants.github.io/nestjs-swagger-api-exception-decorator/) to get started.
## Release Notes
Please visit the [Release Notes](https://nanogiants.github.io/nestjs-swagger-api-exception-decorator/releasenotes/v1.5.0) in our documentation for major and minor releases. Patch releases are documentated in [GitHub Releases](https://github.com/nanogiants/nestjs-swagger-api-exception-decorator/releases).