# @loopback/openapi-v3

> Decorators that annotate LoopBack artifacts with OpenAPI v3 metadata and utilities that transform LoopBack metadata to OpenAPI v3 specifications

Latest version **11.0.16** (published 2026-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @loopback/openapi-v3
pnpm add @loopback/openapi-v3
yarn add @loopback/openapi-v3
bun add @loopback/openapi-v3
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 11.0.16 |
| Published | 2026-08-18 |
| First published | 2018-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | 20 \|\| 22 \|\| 24 |
| Dependencies | 7 |
| Unpacked size | 248.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5106 |
| Author | IBM Corp. and LoopBack contributors |
| Maintainers | rfeng, rmg, dhmlau, theprez, frbuceta, marioestradarosa, achrinza |
| Keywords | Swagger, OpenAPI Spec, TypeScript |

## Links

- npm: https://www.npmjs.com/package/@loopback/openapi-v3
- Repository: https://github.com/loopbackio/loopback-next
- Homepage: https://github.com/loopbackio/loopback-next#readme
- Issues: https://github.com/loopbackio/loopback-next/issues
- npm.io page: https://npm.io/package/@loopback/openapi-v3

## Dependencies (7)

- [debug](https://npm.io/package/debug.md) ^4.4.3
- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [lodash](https://npm.io/package/lodash.md) ^4.18.1
- [http-status](https://npm.io/package/http-status.md) ^1.8.1
- [openapi3-ts](https://npm.io/package/openapi3-ts.md) ^2.0.2
- [json-merge-patch](https://npm.io/package/json-merge-patch.md) ^1.0.2
- [@loopback/repository-json-schema](https://npm.io/package/@loopback/repository-json-schema.md) ^9.0.16

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 11.0.16 (latest) — 2026-08-18
- 0.12.0 (dp3) — 2018-07-20
- 0.7.0 (dp2) — 2018-04-16
- 11.0.15 — 2026-07-16
- 11.0.14 — 2026-06-11
- 11.0.13 — 2026-05-12
- 11.0.12 — 2026-04-14
- 11.0.11 — 2026-03-11
- 11.0.10 — 2026-02-10
- 11.0.9 — 2026-01-12
- 11.0.8 — 2025-12-09
- 11.0.7 — 2025-11-11
- 11.0.6 — 2025-10-15
- 11.0.5 — 2025-09-10
- 11.0.4 — 2025-08-11
- … 187 more at https://npm.io/package/@loopback/openapi-v3/versions

## README

# @loopback/openapi-v3

This package contains:

- Decorators that describe LoopBack artifacts as OpenAPI 3.0.0 metadata.
- Utilities that transfer LoopBack metadata to OpenAPI 3.0.0 specifications.

## Overview

The package has functions described above for LoopBack controller classes.
Decorators apply REST api mapping metadata to controller classes and their
members. And utilities that inspect controller classes to build OpenAPI 3.0.0
specifications from REST API mapping metadata.

Functions for more artifacts will be added when we need.

## Installation

```sh
npm install --save @loopback/openapi-v3
```

## Basic use

Currently this package only has spec generator for controllers. It generates
OpenAPI specifications for a given decorated controller class, including
`paths`, `components.schemas`, and `servers`.

Here is an example of calling function `getControllerSpec` to generate the
OpenAPI spec:

```ts
import {get, getControllerSpec} from '@loopback/openapi-v3';

class MyController {
  @get('/greet')
  greet() {
    return 'Hello world!';
  }
}

const myControllerSpec = getControllerSpec(MyController);
```

then the `myControllerSpec` will be:

```ts
{
  paths: {
    '/greet': {
      get: {
        'x-operation-name': 'greet'
      }
    }
  },
}
```

For details of how to apply controller decorators, please check
<http://loopback.io/doc/en/lb4/Decorators.html#route-decorators>

## Related resources

See <https://www.openapis.org/> and
[version 3.0.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md)
of OpenAPI Specification.

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT

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