Skip to content

JSON Schemas for Loopback configuration & model definition files

Notifications You must be signed in to change notification settings

Sequoia/loopback-json-schemas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoopBack 3 JSON Schemas

This repository contains JSONSchemas for the LoopBack framework. Loopback uses lots of complex json files for configuration, by linking these files to a json schema you can get "intellisense" style type-ahead and some schema validation (detection of illegal properties or types).

⚠️ These schemas do not capture every feature & setting. They are for hints & discovery while coding. Consult docs for best results 👍.

ℹ️ These schemas target loopback version 3.

Using the schemas

Method 1. Use the VS Code plugin ✅ recommended

👉 The VS Code Plugin is the easiest way to use these schemas while writing LoopBack applications! 👈

Method 2. 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"
}

⚠️ Your editor or IDE must support $refs for JSONSchema! Not all do..

If you use a different tool than VSCode and it works with JSONSchema (and $refs!), please send a PR so I can list it here. These tools are worth trying!

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

ℹ️ If you're using VSCode you may as well use method 1

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 2. Read more.

Currently Implemented Schemas

Schemas in this repository cover the following files:

  1. model-config.json
  2. datasources.json
  3. config.json
  4. */models/[Model].json
  5. middleware.json

Contributing

See CONTRIBUTING.md

About

JSON Schemas for Loopback configuration & model definition files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published