@openaddresses/batch-schema 8.1.0 → 9.0.0
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/.eslintrc.json +2 -1
- package/CHANGELOG.md +8 -0
- package/lib/schema.js +3 -3
- package/package.json +1 -1
package/.eslintrc.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
12
|
|
|
13
|
+
### v9.0.0
|
|
14
|
+
|
|
15
|
+
- :rocket: Only JSON parse body if `body` of JSON Schema is set. If body is not set it is up to the caller to parse the body
|
|
16
|
+
|
|
17
|
+
### v8.1.1
|
|
18
|
+
|
|
19
|
+
- :bug: Fix loads call & add `Promise` to ESLint
|
|
20
|
+
|
|
13
21
|
### v8.1.0
|
|
14
22
|
|
|
15
23
|
- :rocket: Load imports faster by using an async call
|
package/lib/schema.js
CHANGED
|
@@ -44,7 +44,7 @@ export default class Schemas {
|
|
|
44
44
|
|
|
45
45
|
if (opts.morgan !== false) this.router.use(morgan('combined'));
|
|
46
46
|
this.router.use(bodyparser.urlencoded({ extended: true }));
|
|
47
|
-
this.
|
|
47
|
+
this.jsonparser = bodyparser.json({ limit: `${opts.limit}mb` });
|
|
48
48
|
|
|
49
49
|
this.schemas = new Map();
|
|
50
50
|
this.validate = this.validator.validate;
|
|
@@ -74,8 +74,6 @@ export default class Schemas {
|
|
|
74
74
|
// Load dynamic routes directory
|
|
75
75
|
for (const r of fs.readdirSync(dirpath)) {
|
|
76
76
|
if (!opts.silent) console.log(`ok - loaded routes/${r}`);
|
|
77
|
-
loads.push(import(path.resolve(dirpath, r)));
|
|
78
|
-
|
|
79
77
|
routes.push((await import(path.resolve(dirpath, r))).default(this, config));
|
|
80
78
|
}
|
|
81
79
|
|
|
@@ -170,6 +168,8 @@ export default class Schemas {
|
|
|
170
168
|
|
|
171
169
|
const flow = [parsed[1], []];
|
|
172
170
|
|
|
171
|
+
if (schemas.body) flow[1].push(this.jsonparser);
|
|
172
|
+
|
|
173
173
|
if (schemas.query) flow[1].push(Middleware.query(schemas.query));
|
|
174
174
|
|
|
175
175
|
// Make sure express params are validated/coerced into proper type
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"root": true,
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "9.0.0",
|
|
7
7
|
"description": "Strongly Validated JSON Schema support for address",
|
|
8
8
|
"repository": "git@github.com:openaddresses/batch-schema",
|
|
9
9
|
"author": "ingalls <nick@ingalls.ca>",
|