# asyncapi-decorators

> AsyncAPI & OpenAPI3 decorators and document builders

Latest version **1.1.3** (published 2020-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install asyncapi-decorators
pnpm add asyncapi-decorators
yarn add asyncapi-decorators
bun add asyncapi-decorators
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2020-09-20 |
| First published | 2020-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 76.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dario Mancuso |
| Maintainers | dario1985 |
| Keywords | asyncapi, openapi, swagger, decorators |

## Links

- npm: https://www.npmjs.com/package/asyncapi-decorators
- npm.io page: https://npm.io/package/asyncapi-decorators

## Dependencies (2)

- [yaml](https://npm.io/package/yaml.md) ^1.10.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.2

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.1.3 (latest) — 2020-09-20
- 1.1.2 — 2020-09-20
- 1.1.1 — 2020-09-20
- 1.1.0 — 2020-09-20
- 1.0.7 — 2020-08-30
- 1.0.6 — 2020-08-30
- 1.0.5 — 2020-08-30
- 1.0.4 — 2020-08-29
- 1.0.3 — 2020-08-29
- 1.0.2 — 2020-08-29
- 1.0.1 — 2020-08-24
- 1.0.0 — 2020-08-24

## README

# asyncapi-decorators

NPM/Yarn module for generate automatic asyncapi documentation

## Getting Started

```
npm i asyncapi-decorators
```

Notes:
* To enable experimental support for metadata decorators in your TypeScript project, you must add `"experimentalDecorators": true` to your `tsconfig.json` file.
* To enable experimental support for auto-generated type metadata in your TypeScript project, you must add `"emitDecoratorMetadata": true` to your `tsconfig.json` file.
Please note that auto-generated type metadata may have issues with circular or forward references for types.

## Decorators

### ApiChannel()

This decorator is used to create a Channel definition. You can add message subscription/publishing using the format `{ publish: YourMessageClass }` or `{ publish: () => YourMessageClass }` (in case you have cross references). 

It optionally accepts all channel item definition schema attributes from [AsyncAPI Channel specification](https://github.com/asyncapi/asyncapi/blob/master/versions/2.0.0/asyncapi.md#channel-item-object)

### ApiMessage()

This decorator is used to create a Message definition. 
It optionally accepts all message definition schema attributes from [AsyncAPI Message specification](https://github.com/asyncapi/asyncapi/blob/master/versions/2.0.0/asyncapi.md#messageObject)

### ApiProperty()

This decorator is used to create a Message property definition. 
It optionally accepts all message property definition schema attributes from [AsyncAPI Message Properties specification](https://github.com/asyncapi/asyncapi/blob/master/versions/2.0.0/asyncapi.md#properties)

## Documentation Builder

```
const yaml: string = new DocumentationBuilder()
  .setTitle('Awesome API')
  .setDescription('Awesome api description')
  .setVersion('v1.0.0')
  .addServer('production', 'http://localhost:3000', 'http')
  .setDefaultContentType('application/json')
  .toYAML();
```
## Examples

Look into the `examples` directory to find some ones.

---
_Source: https://npm.io/package/asyncapi-decorators · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
