Registry / devops / loopback-json-schema-builder

loopback-json-schema-builder

JSON →
library0.0.8jsnpmunverified

Converts LoopBack model definitions into JSON Schema objects for use with form generation libraries like Angular Schema Form. Version 0.0.8 is the latest and was last updated in 2017; the package is unmaintained and has no recent releases. It provides both a CLI and an API to load all models from a LoopBack app or a single model. Unlike alternatives that convert JSON Schema to LoopBack models (e.g., loopback-jsonschema), this package does the reverse direction. It requires a running LoopBack application to introspect models and has no dependencies other than a LoopBack app instance.

npm install loopback-json-schema-builder
INSTALL
IMPORT
SIG · LOOPBACK-JSON-SCHE
L
loopback-json-schema-builder
devopsjavascriptv0.0.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

loadAllModels
import { loadAllModels } from 'loopback-json-schema-builder'
const loadAllModels = require('loopback-json-schema-builder').loadAllModels
ESM import works with bundlers; CJS require also works and can destructure.
default import (entire module)
import schemaBuilder from 'loopback-json-schema-builder'
var schemaBuilder = require('loopback-json-schema-builder').default
CJS require returns the module object directly; no .default needed.
loadModel
import { loadModel } from 'loopback-json-schema-builder'
const loadModel = require('loopback-json-schema-builder').loadModel
Both named and default import work; CJS require with destructuring is also correct.

Shows how to use loadAllModels and loadModel with a LoopBack app to generate JSON schemas.

const loopback = require('loopback'); const app = loopback(); // Assuming you have a LoopBack app with models defined const schemaBuilder = require('loopback-json-schema-builder'); // Load all models and get schemas const schemas = schemaBuilder.loadAllModels(app); console.log(JSON.stringify(schemas, null, 2)); // Load a specific model by name const userSchema = schemaBuilder.loadModel('User'); console.log(JSON.stringify(userSchema, null, 2));
Debug
Known issues
deprecatedPackage is abandoned; no updates since 2017. Not compatible with LoopBack 4.
fix
Migrate to a maintained alternative or write custom schema generation using LoopBack 4's built-in JSON Schema support.
affects: >=0.0.0
gotchaloadModel(name) expects the model name as string; does not validate if model exists.
fix
Ensure the model is loaded in the LoopBack app before calling loadModel, or handle undefined return.
affects: >=0.0.0
gotchaCLI usage requires path to server.js; must be run from the LoopBack project root.
fix
Run the command from the loopback project directory: node node_modules/.bin/loopback-json-schema-builder ./server/server.js
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'loopback-json-schema-builder'
Package not installed or not in node_modules.
fix
Run `npm install loopback-json-schema-builder` in your project root.
loadAllModels is not a function
Incorrect import; using require incorrectly or importing default when named export expected.
fix
Use const schemaBuilder = require('loopback-json-schema-builder'); then schemaBuilder.loadAllModels(app);
Upgrade
Version history
0.0.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
loopback-json-schema-builder — npm install loopback-json-schema-builder · libregistry