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 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"
}
$ref
s for JSONSchema! Not all do..
If you use a different tool than VSCode and it works with JSONSchema (and $ref
s!), 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:
model-config.json
datasources.json
config.json
*/models/[Model].json
middleware.json
Contributing
See CONTRIBUTING.md