🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more
Socket
Book a DemoInstallSign in
Socket

@loopback/repository-json-schema

Package Overview
Dependencies
Maintainers
16
Versions
201
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

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
26K
-6.52%
Maintainers
16
Weekly downloads
 
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 Oct 2018

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