New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

loopback-jsonschema-generator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loopback-jsonschema-generator

Adds JSON schema endpoints for each Loopback model

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-30.77%
Maintainers
1
Weekly downloads
 
Created
Source

Loopback JSON Schema Generator

Build Status Coverage Status npm version

Generates JSON schemas for your LoopBack models

Installing

npm install loopback-jsonschema-generator

Setup

Initialising

Add the following configuration to component-config.js inside your loopback project

{
  "loopback-jsonschema-generator": {}
  ...
}

Configuration options

  • schema - JSON Schema specification
  • url - Url to access each JSON schema endpoint, defaults to 'json-schema'
{
  "loopback-jsonschema-generator": {
    "schema": "http://json-schema.org/draft-04/schema",
    "url": "json-schema"
  }
  ...
}

Using

Define a model inside loopback

# products.json
{
    "name": "Products",
    "base": "PersistedModel",
    "properties": {
        "name": {
          "type": "string",
          "title": "Name",
          "required": true
        }
    },
    "validations": [],
    "relations": {},
    "acls": [],
    "methods": {}
}

Access the JSON schema url

http://yourapi.com/api/products/json-schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Products",
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "title": "Name"
      }
    },
    "required": [
      "name"
    ]
}

References

http://json-schema.org/

FAQs

Package last updated on 02 Dec 2016

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