@openaddresses/batch-schema 9.3.0 → 9.4.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 +4 -0
- package/lib/openapi.js +52 -50
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/openapi.js
CHANGED
|
@@ -31,66 +31,68 @@ export default class Docs {
|
|
|
31
31
|
path = path.join('/');
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
if (!
|
|
34
|
+
if (!schemas.private) {
|
|
35
|
+
if (!this.base.paths[path]) this.base.paths[path] = {};
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
if (this.base.paths[path][method]) throw new Error(`Duplicate Path: ${parsed.join(' ')}`);
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
const document = {
|
|
40
|
+
summary: schemas.description || 'No Description',
|
|
41
|
+
tags: [schemas.group || 'Default'],
|
|
42
|
+
parameters: [],
|
|
43
|
+
responses: {
|
|
44
|
+
200: {
|
|
45
|
+
description: 'Successful Response'
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
for (const key in schemas) {
|
|
50
|
-
if (key[0] === ':') {
|
|
51
|
-
document.parameters.push({
|
|
52
|
-
in: 'path',
|
|
53
|
-
name: key,
|
|
54
|
-
schema: {
|
|
55
|
-
type: schemas[key]
|
|
56
|
-
},
|
|
57
|
-
required: true
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
48
|
+
};
|
|
61
49
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
for (const key in schemas) {
|
|
51
|
+
if (key[0] === ':') {
|
|
52
|
+
document.parameters.push({
|
|
53
|
+
in: 'path',
|
|
54
|
+
name: key,
|
|
55
|
+
schema: {
|
|
56
|
+
type: schemas[key]
|
|
57
|
+
},
|
|
58
|
+
required: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
72
61
|
}
|
|
73
|
-
}
|
|
74
62
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
if (schemas.query && schemas.query.type === 'object') {
|
|
64
|
+
for (const name in (schemas.query.properties || {})) {
|
|
65
|
+
const query = schemas.query.properties[name];
|
|
66
|
+
document.parameters.push({
|
|
67
|
+
in: 'query',
|
|
68
|
+
name,
|
|
69
|
+
schema: query,
|
|
70
|
+
required: query.required || (schemas.query.required || []).includes(name),
|
|
71
|
+
description: query.description || 'No Description'
|
|
72
|
+
});
|
|
79
73
|
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
74
|
+
}
|
|
82
75
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
required: true,
|
|
86
|
-
content: {
|
|
76
|
+
if (schemas.res) {
|
|
77
|
+
document.responses['200'].content = {
|
|
87
78
|
'application/json': {
|
|
88
|
-
schema: schemas.
|
|
79
|
+
schema: schemas.res
|
|
89
80
|
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
93
83
|
|
|
94
|
-
|
|
84
|
+
if (schemas.body) {
|
|
85
|
+
document.requestBody = {
|
|
86
|
+
required: true,
|
|
87
|
+
content: {
|
|
88
|
+
'application/json': {
|
|
89
|
+
schema: schemas.body
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
this.base.paths[path][method] = document;
|
|
96
|
+
}
|
|
95
97
|
}
|
|
96
98
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"root": true,
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"version": "9.
|
|
6
|
+
"version": "9.4.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>",
|