# annotations-to-swagger

> Scan js files in the current directory, look for annotations based on the JSDoc format (https://brikev.github.io/express-jsdoc-swagger-docs) - generate an openapi.json file - generate a swagger documentation UI (based on openapi.json using swagger-to-stat

Latest version **1.0.8** (published 2023-02-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install annotations-to-swagger
pnpm add annotations-to-swagger
yarn add annotations-to-swagger
bun add annotations-to-swagger
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2023-02-10 |
| First published | 2023-01-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | guik |

## Links

- npm: https://www.npmjs.com/package/annotations-to-swagger
- Repository: https://github.com/Guik/annotations-to-swagger
- Homepage: https://github.com/Guik/annotations-to-swagger#readme
- Issues: https://github.com/Guik/annotations-to-swagger/issues
- npm.io page: https://npm.io/package/annotations-to-swagger

## Dependencies (2)

- [swagger-to-static](https://npm.io/package/swagger-to-static.md) ^1.1.0
- [express-jsdoc-swagger](https://npm.io/package/express-jsdoc-swagger.md) ^1.8.0

## Recent versions

- 1.0.8 (latest) — 2023-02-10
- 1.0.7 — 2023-01-25
- 1.0.6 — 2023-01-25
- 1.0.5 — 2023-01-25
- 1.0.4 — 2023-01-23
- 1.0.3 — 2023-01-23
- 1.0.2 — 2023-01-19
- 1.0.1 — 2023-01-19
- 1.0.0 — 2023-01-19

## README

# annotations-to-swagger
Scan js files in the current directory, look for annotations based on the JSDoc format (https://brikev.github.io/express-jsdoc-swagger-docs)
- generate an openapi.json file
- generate a swagger documentation UI (based on openapi.json using swagger-to-static)

Ideal for integrating with serverless scriptable hooks to generate documentation on the fly.

# Usage

## Install

`npm install annotations-to-swagger --save-dev`

or

`yarn add annotations-to-swagger --dev`

## Use

The generated openapi.json file & swagger will be located in the docs folder

- @param {string} serviceName - The name of the service
- @param {string} description - The description of the service
- @param {string} servers - The servers of the service (comma separated)
- @param {string} destinationPath - The path where documentation files will be generated (optional, default: ./docs)


Usage: ```node ./node_modules/annotations-to-swagger/index.js <serviceName> <description> <servers> <destinationPath> <folderToScan>```

Example: ```node ./node_modules/annotations-to-swagger/index.js myServiceName "This is a description of my service" "https://example.com/dev,https://example.com/prod" ./docs ./src/*.js```

serverless usage: 
``` 
environment:
    DOC_DESCRIPTION: "myServiceName"
    DOC_SERVERS: "https://example.com/dev,https://example.com/prod"
custom:
    scriptable:
        hooks:
            before:package:initialize: node ./node_modules/annotations-to-swagger/index.js ${self:service} "${self:provider.environment.DOC_DESCRIPTION}" "${self:provider.environment.DOC_SERVERS}"
```

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