Skip to content

Latest commit

 

History

History
48 lines (39 loc) · 2.4 KB

File metadata and controls

48 lines (39 loc) · 2.4 KB

LoopBack JSON Schemas

This repository contains JSONSchemas for the LoopBack framework.

⚠️ These schemas are a work in progress & do not capture every feature & setting. Consult docs for best results 👍.

ℹ️ These schemas target loopback version 3 which is not 100% compatible with most loopback applications currently in production. I chose to target the next version in the interest of being forward looking & because time is limited.

Roadmap in TODO.md. 👈 This is where to contribute if you'd like to help!

Using the schemas

Method 1. Point json files to schemas

Using an IDE that supports JSONSchemas (I recommend VS Code), point to a schema thus: common/models/customer.json

{
  "$schema" : "https://raw.githubusercontent.com/Sequoia/loopback-json-schemas/master/dist/loopback-model-definition.json"
}

Method 2. Map schemas to file by file paths (VS Code)

Edit your jsconfig.json in VS Code to map schemas to file paths in your project:


    {
      "fileMatch": "/common/models/*.json",
      "url": "https://raw.githubusercontent.com/Sequoia/loopback-json-schemas/master/dist/loopback-model-definition.json"
    },
    {

This will automatically link schemas to paths so you don't have to use Method 1. Read more.

Method 3. Use the VS Code plugin

⚠️ WIP! VS Code Plugin

This will automatically link schemas to paths so you don't have to use Method 2.

Developing

  • Clone repository & run npm install
  • Run npm serve to serve for local testing
    • You can create a separate project (e.g. in VS Code) and point to your local definitions from a json file thus:
      {
        "$schema" : "http://localhost:8090/shared-refs.json"
      }
      
  • When you're ready to push & submit a PR, run npm run build which
    1. copies files from src to dist
    2. replaces http://localhost:8090 with the real base url for the schemas. This is currently github but will likely be schema store later.