@openaddresses/batch-schema 7.4.0 → 7.6.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/CHANGELOG.md +8 -0
- package/lib/schema.js +13 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/lib/schema.js
CHANGED
|
@@ -71,7 +71,7 @@ export default class Schemas {
|
|
|
71
71
|
|
|
72
72
|
// Load dynamic routes directory
|
|
73
73
|
for (const r of fs.readdirSync(dirpath)) {
|
|
74
|
-
if (!opts.silent) console.
|
|
74
|
+
if (!opts.silent) console.log(`ok - loaded routes/${r}`);
|
|
75
75
|
await (await import(path.resolve(dirpath, r))).default(this, config);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -85,7 +85,7 @@ export default class Schemas {
|
|
|
85
85
|
* @param {boolean} opts.silent Squelch StdOut
|
|
86
86
|
*/
|
|
87
87
|
async blueprint(bp_class, config, opts = {}) {
|
|
88
|
-
if (!opts.silent) console.
|
|
88
|
+
if (!opts.silent) console.log(`ok - loaded ${bp_class.name}`);
|
|
89
89
|
await bp_class.blueprint(this, config);
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -140,11 +140,17 @@ export default class Schemas {
|
|
|
140
140
|
if (!schemas[type]) continue;
|
|
141
141
|
|
|
142
142
|
// TODO: Write schemas to a tmp directory so blueprints & main schemas are in the same place
|
|
143
|
-
schemas[
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
if (typeof schemas[type] === 'object') {
|
|
144
|
+
schemas[`${type}_url`] = null;
|
|
145
|
+
} else if (typeof schemas[type] === 'string') {
|
|
146
|
+
schemas[`${type}_url`] = '../schema/' + schemas[type];
|
|
147
|
+
try {
|
|
148
|
+
schemas[type] = await $RefParser.dereference((new URL(`../schema/${schemas[type]}`, import.meta.url)).pathname);
|
|
149
|
+
} catch (err) {
|
|
150
|
+
schemas[type] = await $RefParser.dereference(`${this.schemas_path}/${schemas[type]}`);
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
throw new Error(`Unsupported Value in ${type} value for ${url}`);
|
|
148
154
|
}
|
|
149
155
|
}
|
|
150
156
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"root": true,
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"version": "7.
|
|
6
|
+
"version": "7.6.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>",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"doc": "documentation build index.js -f html -o docs && documentation lint index.js"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@openaddresses/batch-error": "^1.
|
|
21
|
+
"@openaddresses/batch-error": "^2.1.2",
|
|
22
22
|
"ajv": "^8.6.3",
|
|
23
23
|
"ajv-formats": "^2.1.1",
|
|
24
24
|
"body-parser": "^1.20.0",
|