Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loopback/repository-json-schema

Package Overview
Dependencies
Maintainers
9
Versions
188
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

  • 3.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36K
increased by7.47%
Maintainers
9
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

FAQs

Package last updated on 06 Apr 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc