json-server 0.17.2 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli/run.js CHANGED
@@ -26,6 +26,8 @@ function prettyPrint(argv, object, rules) {
26
26
  console.log(chalk.bold(' Resources'));
27
27
 
28
28
  for (const prop in object) {
29
+ // skip printing $schema nodes
30
+ if (prop === '$schema') continue;
29
31
  console.log(` ${root}/${prop}`);
30
32
  }
31
33
 
@@ -65,6 +65,11 @@ module.exports = (db, opts) => {
65
65
  router.use(nested(opts)); // Create routes
66
66
 
67
67
  db.forEach((value, key) => {
68
+ if (key === '$schema') {
69
+ // ignore $schema
70
+ return;
71
+ }
72
+
68
73
  if (_.isPlainObject(value)) {
69
74
  router.use(`/${key}`, singular(db, key, opts));
70
75
  return;
@@ -13,7 +13,7 @@ module.exports = obj => {
13
13
  if (_.isPlainObject(obj)) {
14
14
  Object.keys(obj).forEach(validateKey);
15
15
  } else {
16
- throw new Error(`Data must be an object. Found ${Array.isArray(obj) ? 'array' : typeof obj}
16
+ throw new Error(`Data must be an object. Found ${Array.isArray(obj) ? 'array' : typeof obj}.
17
17
  'See https://github.com/typicode/json-server for example.`);
18
18
  }
19
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-server",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "description": "Get a full fake REST API with zero coding in less than 30 seconds",
5
5
  "main": "./lib/server/index.js",
6
6
  "bin": "./lib/cli/bin.js",
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "scripts": {
12
12
  "prepare": "husky install",
13
- "test": "npm run build && cross-env NODE_ENV=test jest && npm run lint",
13
+ "test": "npm run build && cross-env NODE_ENV=test jest",
14
14
  "start": "babel-node -- src/cli/bin db.json -r routes.json",
15
15
  "lint": "eslint . --ignore-path .gitignore",
16
16
  "fix": "npm run lint -- --fix",