Socket
Book a DemoInstallSign in
Socket

@loopback/repository-json-schema

Package Overview
Dependencies
Maintainers
7
Versions
200
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loopback/repository-json-schema

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

latest
Source
npmnpm
Version
9.0.5
Version published
Maintainers
7
Created
Source

@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

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

Basic use

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:

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

Contributions

  • Guidelines
  • Join the team

Tests

Run npm test from the root folder.

Contributors

See all contributors.

License

MIT

Keywords

LoopBack

FAQs

Package last updated on 10 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts