# @loopback/repository-json-schema

> Converts TS classes into JSON Schemas using TypeScript's reflection API

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

## Install

```sh
npm install @loopback/repository-json-schema
pnpm add @loopback/repository-json-schema
yarn add @loopback/repository-json-schema
bun add @loopback/repository-json-schema
```

## 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 | 9.0.16 |
| Published | 2026-08-18 |
| First published | 2018-01-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | 20 \|\| 22 \|\| 24 |
| Dependencies | 3 |
| Unpacked size | 82.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5107 |
| Author | IBM Corp. and LoopBack contributors |
| Maintainers | rfeng, rmg, dhmlau, theprez, frbuceta, marioestradarosa, achrinza |
| Keywords | LoopBack, TypeScript, JSON Schema |

## Links

- npm: https://www.npmjs.com/package/@loopback/repository-json-schema
- 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/repository-json-schema

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^4.4.3
- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [@types/json-schema](https://npm.io/package/@types/json-schema.md) ^7.0.15

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 9.0.16 (latest) — 2026-08-18
- 0.10.0 (dp3) — 2018-07-20
- 0.6.0 (dp2) — 2018-04-16
- 9.0.15 — 2026-07-16
- 9.0.14 — 2026-06-11
- 9.0.13 — 2026-05-12
- 9.0.12 — 2026-04-14
- 9.0.11 — 2026-03-11
- 9.0.10 — 2026-02-10
- 9.0.9 — 2026-01-12
- 9.0.8 — 2025-12-09
- 9.0.7 — 2025-11-11
- 9.0.6 — 2025-10-15
- 9.0.5 — 2025-09-10
- 9.0.4 — 2025-08-11
- … 196 more at https://npm.io/package/@loopback/repository-json-schema/versions

## README

# @loopback/repository-json-schema

Convert a TypeScript class/model to a JSON Schema for users, leveraging
LoopBack4's decorators, metadata, and reflection system.

## Overview

This package provides modules to easily convert LoopBack4 models that have been
decorated with `@model` and `@property` to a matching JSON Schema Definition.

## Installation

```shell
$ npm install --save @loopback/repository-json-schema
```

## Basic use

```ts
import {getJsonSchema} from '@loopback/repository-json-schema';
import {model, property} from '@loopback/repository';

@model()
class MyModel {
  @property()
  name: string;
}

const jsonSchema = getJsonSchema(MyModel);
```

The value of `jsonSchema` will be:

```json
{
  "title": "MyModel",
  "properties": {
    "name": {
      "type": "string"
    }
  }
}
```

## 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/repository-json-schema · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
