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.
👉 The VS Code Plugin is the easiest way to use these schemas while writing LoopBack applications! 👈
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!
ℹ️ 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.
Schemas in this repository cover the following files:
model-config.json
datasources.json
config.json
*/models/[Model].json
middleware.json
See CONTRIBUTING.md