apib2swagger 1.14.1 → 1.15.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/bin/apib2swagger.js +6 -0
- package/package.json +3 -3
- package/src/mson_to_json_schema.js +14 -6
- package/test/input/OpenAPI3_Issue-#66.md +6 -0
- package/test/output/08. Attributes.ref.json +4 -1
- package/test/output/09. Advanced Attributes.json +6 -2
- package/test/output/09. Advanced Attributes.ref.json +6 -2
- package/test/output/10. Data Structures.json +4 -1
- package/test/output/10. Data Structures.ref.json +4 -1
- package/test/output/Issue-#15.json +12 -1
- package/test/output/Issue-#15.ref.json +16 -3
- package/test/output/Issue-#29.json +12 -6
- package/test/output/Issue-#29.ref.json +12 -6
- package/test/output/Issue-#33.ref.json +2 -0
- package/test/output/OpenAPI3_Issue-#66.json +40 -0
- package/test/output/OpenAPI3_Issue-#66.ref.json +40 -0
- package/test/output/OpenAPI3_attributes.ref.json +157 -156
- package/test/test.js +2 -1
package/bin/apib2swagger.js
CHANGED
|
@@ -111,6 +111,12 @@ function processBlueprint(blueprint, opts) {
|
|
|
111
111
|
};
|
|
112
112
|
apib2swagger.convert(blueprint, options, function(error, result) {
|
|
113
113
|
if (error) {
|
|
114
|
+
if (error.stack && error.result) {
|
|
115
|
+
// override toString() of drafter's error to expand error.result.error.location
|
|
116
|
+
console.log(error.stack);
|
|
117
|
+
console.log(JSON.stringify(error.result, 0, 2));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
114
120
|
console.log(error);
|
|
115
121
|
return;
|
|
116
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apib2swagger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Convert API Blueprint to Swagger.",
|
|
5
5
|
"bin": "./bin/apib2swagger.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"coveralls": "^3.1.1",
|
|
31
31
|
"cross-env": "^5.2.0",
|
|
32
|
-
"mocha": "^
|
|
33
|
-
"nyc": "^
|
|
32
|
+
"mocha": "^10.0.0",
|
|
33
|
+
"nyc": "^15.1.0",
|
|
34
34
|
"sinon": "^12.0.1",
|
|
35
35
|
"tv4": "^1.2.7"
|
|
36
36
|
}
|
|
@@ -38,6 +38,9 @@ function convert(mson, options) {
|
|
|
38
38
|
case 'boolean':
|
|
39
39
|
case 'string':
|
|
40
40
|
case 'number':
|
|
41
|
+
if (mson.content) {
|
|
42
|
+
return { type: mson.element, example: mson.content };
|
|
43
|
+
}
|
|
41
44
|
return { type: mson.element };
|
|
42
45
|
default:
|
|
43
46
|
if (!mson.content) {
|
|
@@ -51,11 +54,11 @@ function convert(mson, options) {
|
|
|
51
54
|
schema.required = [];
|
|
52
55
|
schema.properties = {};
|
|
53
56
|
for (var j = 0; mson.content && j < mson.content.length; j++) {
|
|
54
|
-
|
|
57
|
+
const member = mson.content[j];
|
|
55
58
|
if (member.element !== "member") continue;
|
|
56
|
-
|
|
59
|
+
var propertySchema = convert(member.content.value, options);
|
|
57
60
|
if (member.meta && member.meta.description) {
|
|
58
|
-
|
|
61
|
+
propertySchema.description = member.meta.description;
|
|
59
62
|
}
|
|
60
63
|
var fixedType = false;
|
|
61
64
|
if (member.attributes && member.attributes.typeAttributes) {
|
|
@@ -68,14 +71,19 @@ function convert(mson, options) {
|
|
|
68
71
|
schema.required.push(member.content.key.content);
|
|
69
72
|
break;
|
|
70
73
|
case 'nullable':
|
|
71
|
-
|
|
74
|
+
if (propertySchema.$ref) {
|
|
75
|
+
propertySchema = {oneOf: [propertySchema, {type: 'null'}]};
|
|
76
|
+
} else {
|
|
77
|
+
propertySchema.type = [propertySchema.type, 'null']
|
|
78
|
+
}
|
|
72
79
|
break;
|
|
73
80
|
}
|
|
74
81
|
});
|
|
75
82
|
}
|
|
76
|
-
if (
|
|
77
|
-
|
|
83
|
+
if (propertySchema.type === 'array' && !fixedType) {
|
|
84
|
+
propertySchema.items = {}; // reset item schema
|
|
78
85
|
}
|
|
86
|
+
schema.properties[member.content.key.content] = propertySchema;
|
|
79
87
|
}
|
|
80
88
|
|
|
81
89
|
// According to schema definition, required is a stringArray, which must be non-empty
|
|
@@ -17,14 +17,17 @@
|
|
|
17
17
|
"type": "object",
|
|
18
18
|
"properties": {
|
|
19
19
|
"id": {
|
|
20
|
-
"type": "string"
|
|
20
|
+
"type": "string",
|
|
21
|
+
"example": "250FF"
|
|
21
22
|
},
|
|
22
23
|
"created": {
|
|
23
24
|
"type": "number",
|
|
25
|
+
"example": 1415203908,
|
|
24
26
|
"description": "Time stamp"
|
|
25
27
|
},
|
|
26
28
|
"percent_off": {
|
|
27
29
|
"type": "number",
|
|
30
|
+
"example": 25,
|
|
28
31
|
"description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
|
|
29
32
|
},
|
|
30
33
|
"redeem_by": {
|
|
@@ -153,7 +153,8 @@
|
|
|
153
153
|
"type": "object",
|
|
154
154
|
"properties": {
|
|
155
155
|
"percent_off": {
|
|
156
|
-
"type": "number"
|
|
156
|
+
"type": "number",
|
|
157
|
+
"example": 25
|
|
157
158
|
},
|
|
158
159
|
"redeem_by": {
|
|
159
160
|
"type": "number"
|
|
@@ -173,14 +174,17 @@
|
|
|
173
174
|
"type": "object",
|
|
174
175
|
"properties": {
|
|
175
176
|
"id": {
|
|
176
|
-
"type": "string"
|
|
177
|
+
"type": "string",
|
|
178
|
+
"example": "250FF"
|
|
177
179
|
},
|
|
178
180
|
"created": {
|
|
179
181
|
"type": "number",
|
|
182
|
+
"example": 1415203908,
|
|
180
183
|
"description": "Time stamp"
|
|
181
184
|
},
|
|
182
185
|
"percent_off": {
|
|
183
186
|
"type": "number",
|
|
187
|
+
"example": 25,
|
|
184
188
|
"description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
|
|
185
189
|
},
|
|
186
190
|
"redeem_by": {
|
|
@@ -118,7 +118,8 @@
|
|
|
118
118
|
"type": "object",
|
|
119
119
|
"properties": {
|
|
120
120
|
"percent_off": {
|
|
121
|
-
"type": "number"
|
|
121
|
+
"type": "number",
|
|
122
|
+
"example": 25
|
|
122
123
|
},
|
|
123
124
|
"redeem_by": {
|
|
124
125
|
"type": "number"
|
|
@@ -138,14 +139,17 @@
|
|
|
138
139
|
"type": "object",
|
|
139
140
|
"properties": {
|
|
140
141
|
"id": {
|
|
141
|
-
"type": "string"
|
|
142
|
+
"type": "string",
|
|
143
|
+
"example": "250FF"
|
|
142
144
|
},
|
|
143
145
|
"created": {
|
|
144
146
|
"type": "number",
|
|
147
|
+
"example": 1415203908,
|
|
145
148
|
"description": "Time stamp"
|
|
146
149
|
},
|
|
147
150
|
"percent_off": {
|
|
148
151
|
"type": "number",
|
|
152
|
+
"example": 25,
|
|
149
153
|
"description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
|
|
150
154
|
},
|
|
151
155
|
"redeem_by": {
|
|
@@ -170,10 +170,12 @@
|
|
|
170
170
|
"type": "object",
|
|
171
171
|
"properties": {
|
|
172
172
|
"id": {
|
|
173
|
-
"type": "string"
|
|
173
|
+
"type": "string",
|
|
174
|
+
"example": "250FF"
|
|
174
175
|
},
|
|
175
176
|
"created": {
|
|
176
177
|
"type": "number",
|
|
178
|
+
"example": 1415203908,
|
|
177
179
|
"description": "Time stamp"
|
|
178
180
|
}
|
|
179
181
|
}
|
|
@@ -189,6 +191,7 @@
|
|
|
189
191
|
"properties": {
|
|
190
192
|
"percent_off": {
|
|
191
193
|
"type": "number",
|
|
194
|
+
"example": 25,
|
|
192
195
|
"description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
|
|
193
196
|
},
|
|
194
197
|
"redeem_by": {
|
|
@@ -135,10 +135,12 @@
|
|
|
135
135
|
"type": "object",
|
|
136
136
|
"properties": {
|
|
137
137
|
"id": {
|
|
138
|
-
"type": "string"
|
|
138
|
+
"type": "string",
|
|
139
|
+
"example": "250FF"
|
|
139
140
|
},
|
|
140
141
|
"created": {
|
|
141
142
|
"type": "number",
|
|
143
|
+
"example": 1415203908,
|
|
142
144
|
"description": "Time stamp"
|
|
143
145
|
}
|
|
144
146
|
}
|
|
@@ -154,6 +156,7 @@
|
|
|
154
156
|
"properties": {
|
|
155
157
|
"percent_off": {
|
|
156
158
|
"type": "number",
|
|
159
|
+
"example": 25,
|
|
157
160
|
"description": "A positive integer between 1 and 100 that represents the discount the coupon will apply."
|
|
158
161
|
},
|
|
159
162
|
"redeem_by": {
|
|
@@ -226,45 +226,56 @@
|
|
|
226
226
|
"properties": {
|
|
227
227
|
"id": {
|
|
228
228
|
"type": "number",
|
|
229
|
+
"example": 1,
|
|
229
230
|
"description": "unique numerical identified"
|
|
230
231
|
},
|
|
231
232
|
"principal_id": {
|
|
232
233
|
"type": "number",
|
|
234
|
+
"example": 1,
|
|
233
235
|
"description": "unique numerical identified across users and groups"
|
|
234
236
|
},
|
|
235
237
|
"provider_key": {
|
|
236
238
|
"type": "string",
|
|
239
|
+
"example": "p401",
|
|
237
240
|
"description": "unique identifier in string format"
|
|
238
241
|
},
|
|
239
242
|
"email": {
|
|
240
243
|
"type": "string",
|
|
244
|
+
"example": "chad@test.com",
|
|
241
245
|
"description": "email address"
|
|
242
246
|
},
|
|
243
247
|
"email_hash": {
|
|
244
248
|
"type": "string",
|
|
249
|
+
"example": "a51b767bfd8fccf9b5831a99e1f97c81",
|
|
245
250
|
"description": "hashed email address"
|
|
246
251
|
},
|
|
247
252
|
"username": {
|
|
248
253
|
"type": "string",
|
|
254
|
+
"example": "admin",
|
|
249
255
|
"description": "username of the user"
|
|
250
256
|
},
|
|
251
257
|
"first_name": {
|
|
252
258
|
"type": "string",
|
|
259
|
+
"example": "Chad",
|
|
253
260
|
"description": "the first name of the user"
|
|
254
261
|
},
|
|
255
262
|
"last_name": {
|
|
256
263
|
"type": "string",
|
|
264
|
+
"example": "Smith",
|
|
257
265
|
"description": "the last name of the user"
|
|
258
266
|
},
|
|
259
267
|
"password": {
|
|
260
|
-
"type": "string"
|
|
268
|
+
"type": "string",
|
|
269
|
+
"example": "password"
|
|
261
270
|
},
|
|
262
271
|
"user_role": {
|
|
263
272
|
"type": "string",
|
|
273
|
+
"example": "administrator",
|
|
264
274
|
"description": "the role of the user"
|
|
265
275
|
},
|
|
266
276
|
"confirmed": {
|
|
267
277
|
"type": "boolean",
|
|
278
|
+
"example": true,
|
|
268
279
|
"description": "has the user been confirmed"
|
|
269
280
|
},
|
|
270
281
|
"locked": {
|
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
],
|
|
32
32
|
"properties": {
|
|
33
33
|
"version": {
|
|
34
|
-
"type": "string"
|
|
34
|
+
"type": "string",
|
|
35
|
+
"example": "software version"
|
|
35
36
|
},
|
|
36
37
|
"build": {
|
|
37
|
-
"type": "string"
|
|
38
|
+
"type": "string",
|
|
39
|
+
"example": "software build"
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
}
|
|
@@ -163,45 +165,56 @@
|
|
|
163
165
|
"properties": {
|
|
164
166
|
"id": {
|
|
165
167
|
"type": "number",
|
|
168
|
+
"example": 1,
|
|
166
169
|
"description": "unique numerical identified"
|
|
167
170
|
},
|
|
168
171
|
"principal_id": {
|
|
169
172
|
"type": "number",
|
|
173
|
+
"example": 1,
|
|
170
174
|
"description": "unique numerical identified across users and groups"
|
|
171
175
|
},
|
|
172
176
|
"provider_key": {
|
|
173
177
|
"type": "string",
|
|
178
|
+
"example": "p401",
|
|
174
179
|
"description": "unique identifier in string format"
|
|
175
180
|
},
|
|
176
181
|
"email": {
|
|
177
182
|
"type": "string",
|
|
183
|
+
"example": "chad@test.com",
|
|
178
184
|
"description": "email address"
|
|
179
185
|
},
|
|
180
186
|
"email_hash": {
|
|
181
187
|
"type": "string",
|
|
188
|
+
"example": "a51b767bfd8fccf9b5831a99e1f97c81",
|
|
182
189
|
"description": "hashed email address"
|
|
183
190
|
},
|
|
184
191
|
"username": {
|
|
185
192
|
"type": "string",
|
|
193
|
+
"example": "admin",
|
|
186
194
|
"description": "username of the user"
|
|
187
195
|
},
|
|
188
196
|
"first_name": {
|
|
189
197
|
"type": "string",
|
|
198
|
+
"example": "Chad",
|
|
190
199
|
"description": "the first name of the user"
|
|
191
200
|
},
|
|
192
201
|
"last_name": {
|
|
193
202
|
"type": "string",
|
|
203
|
+
"example": "Smith",
|
|
194
204
|
"description": "the last name of the user"
|
|
195
205
|
},
|
|
196
206
|
"password": {
|
|
197
|
-
"type": "string"
|
|
207
|
+
"type": "string",
|
|
208
|
+
"example": "password"
|
|
198
209
|
},
|
|
199
210
|
"user_role": {
|
|
200
211
|
"type": "string",
|
|
212
|
+
"example": "administrator",
|
|
201
213
|
"description": "the role of the user"
|
|
202
214
|
},
|
|
203
215
|
"confirmed": {
|
|
204
216
|
"type": "boolean",
|
|
217
|
+
"example": true,
|
|
205
218
|
"description": "has the user been confirmed"
|
|
206
219
|
},
|
|
207
220
|
"locked": {
|
|
@@ -186,10 +186,12 @@
|
|
|
186
186
|
],
|
|
187
187
|
"properties": {
|
|
188
188
|
"id": {
|
|
189
|
-
"type": "number"
|
|
189
|
+
"type": "number",
|
|
190
|
+
"example": 42
|
|
190
191
|
},
|
|
191
192
|
"text": {
|
|
192
|
-
"type": "string"
|
|
193
|
+
"type": "string",
|
|
194
|
+
"example": "Hello World"
|
|
193
195
|
},
|
|
194
196
|
"author": {
|
|
195
197
|
"$ref": "#/definitions/Author",
|
|
@@ -207,10 +209,12 @@
|
|
|
207
209
|
"type": "object",
|
|
208
210
|
"properties": {
|
|
209
211
|
"name": {
|
|
210
|
-
"type": "string"
|
|
212
|
+
"type": "string",
|
|
213
|
+
"example": "Boba Fett"
|
|
211
214
|
},
|
|
212
215
|
"email": {
|
|
213
|
-
"type": "string"
|
|
216
|
+
"type": "string",
|
|
217
|
+
"example": "fett@intergalactic.com"
|
|
214
218
|
}
|
|
215
219
|
}
|
|
216
220
|
},
|
|
@@ -218,10 +222,12 @@
|
|
|
218
222
|
"type": "object",
|
|
219
223
|
"properties": {
|
|
220
224
|
"name": {
|
|
221
|
-
"type": "string"
|
|
225
|
+
"type": "string",
|
|
226
|
+
"example": "Lando Calrissian"
|
|
222
227
|
},
|
|
223
228
|
"email": {
|
|
224
|
-
"type": "string"
|
|
229
|
+
"type": "string",
|
|
230
|
+
"example": "lando@intergalactic.com"
|
|
225
231
|
}
|
|
226
232
|
}
|
|
227
233
|
}
|
|
@@ -148,10 +148,12 @@
|
|
|
148
148
|
],
|
|
149
149
|
"properties": {
|
|
150
150
|
"id": {
|
|
151
|
-
"type": "number"
|
|
151
|
+
"type": "number",
|
|
152
|
+
"example": 42
|
|
152
153
|
},
|
|
153
154
|
"text": {
|
|
154
|
-
"type": "string"
|
|
155
|
+
"type": "string",
|
|
156
|
+
"example": "Hello World"
|
|
155
157
|
},
|
|
156
158
|
"author": {
|
|
157
159
|
"$ref": "#/definitions/Author",
|
|
@@ -169,10 +171,12 @@
|
|
|
169
171
|
"type": "object",
|
|
170
172
|
"properties": {
|
|
171
173
|
"name": {
|
|
172
|
-
"type": "string"
|
|
174
|
+
"type": "string",
|
|
175
|
+
"example": "Boba Fett"
|
|
173
176
|
},
|
|
174
177
|
"email": {
|
|
175
|
-
"type": "string"
|
|
178
|
+
"type": "string",
|
|
179
|
+
"example": "fett@intergalactic.com"
|
|
176
180
|
}
|
|
177
181
|
}
|
|
178
182
|
},
|
|
@@ -180,10 +184,12 @@
|
|
|
180
184
|
"type": "object",
|
|
181
185
|
"properties": {
|
|
182
186
|
"name": {
|
|
183
|
-
"type": "string"
|
|
187
|
+
"type": "string",
|
|
188
|
+
"example": "Lando Calrissian"
|
|
184
189
|
},
|
|
185
190
|
"email": {
|
|
186
|
-
"type": "string"
|
|
191
|
+
"type": "string",
|
|
192
|
+
"example": "lando@intergalactic.com"
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
195
|
}
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"properties": {
|
|
56
56
|
"state": {
|
|
57
57
|
"type": "string",
|
|
58
|
+
"example": "COMPLETED",
|
|
58
59
|
"description": "State code"
|
|
59
60
|
},
|
|
60
61
|
"stateCounters": {
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
},
|
|
73
74
|
"count": {
|
|
74
75
|
"type": "number",
|
|
76
|
+
"example": 5,
|
|
75
77
|
"description": "number of plans"
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": ""
|
|
7
|
+
},
|
|
8
|
+
"paths": {},
|
|
9
|
+
"components": {
|
|
10
|
+
"schemas": {
|
|
11
|
+
"ImagesType": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"BodyType": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": [
|
|
22
|
+
"images"
|
|
23
|
+
],
|
|
24
|
+
"properties": {
|
|
25
|
+
"images": {
|
|
26
|
+
"oneOf": [
|
|
27
|
+
{
|
|
28
|
+
"$ref": "#/components/schemas/ImagesType"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"nullable": true
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"tags": []
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": ""
|
|
7
|
+
},
|
|
8
|
+
"paths": {},
|
|
9
|
+
"components": {
|
|
10
|
+
"schemas": {
|
|
11
|
+
"ImagesType": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"BodyType": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": [
|
|
22
|
+
"images"
|
|
23
|
+
],
|
|
24
|
+
"properties": {
|
|
25
|
+
"images": {
|
|
26
|
+
"oneOf": [
|
|
27
|
+
{
|
|
28
|
+
"$ref": "#/components/schemas/ImagesType"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"nullable": true
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"tags": []
|
|
40
|
+
}
|
|
@@ -1,173 +1,174 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"$ref": "#/components/schemas/OtherMessage"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
"examples": {
|
|
38
|
-
"example1": {
|
|
39
|
-
"value": {
|
|
40
|
-
"message": ""
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"example2": {
|
|
44
|
-
"value": {
|
|
45
|
-
"otherMessage": "",
|
|
46
|
-
"someNum": 0
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": ""
|
|
7
|
+
},
|
|
8
|
+
"servers": [
|
|
9
|
+
{
|
|
10
|
+
"url": "https://www.testhost.com"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"paths": {
|
|
14
|
+
"/object": {
|
|
15
|
+
"get": {
|
|
16
|
+
"responses": {
|
|
17
|
+
"200": {
|
|
18
|
+
"description": "OK",
|
|
19
|
+
"headers": {},
|
|
20
|
+
"content": {
|
|
21
|
+
"application/json": {
|
|
22
|
+
"schema": {
|
|
23
|
+
"oneOf": [
|
|
24
|
+
{
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"message": {
|
|
28
|
+
"type": "string"
|
|
51
29
|
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"$ref": "#/components/schemas/OtherMessage"
|
|
52
34
|
}
|
|
35
|
+
]
|
|
53
36
|
},
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"parameters": []
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"/array/object": {
|
|
62
|
-
"post": {
|
|
63
|
-
"responses": {
|
|
64
|
-
"200": {
|
|
65
|
-
"description": "OK",
|
|
66
|
-
"headers": {},
|
|
67
|
-
"content": {
|
|
68
|
-
"application/json": {
|
|
69
|
-
"schema": {
|
|
70
|
-
"type": "array",
|
|
71
|
-
"items": {
|
|
72
|
-
"type": "object",
|
|
73
|
-
"required": [
|
|
74
|
-
"path"
|
|
75
|
-
],
|
|
76
|
-
"properties": {
|
|
77
|
-
"path": {
|
|
78
|
-
"type": "string"
|
|
79
|
-
},
|
|
80
|
-
"otherMessage": {
|
|
81
|
-
"$ref": "#/components/schemas/OtherMessage"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"example": [
|
|
87
|
-
{
|
|
88
|
-
"path": "/files",
|
|
89
|
-
"otherMessage": {
|
|
90
|
-
"otherMessage": "",
|
|
91
|
-
"someNum": 0
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
37
|
+
"examples": {
|
|
38
|
+
"example1": {
|
|
39
|
+
"value": {
|
|
40
|
+
"message": ""
|
|
97
41
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"parameters": [],
|
|
104
|
-
"requestBody": {
|
|
105
|
-
"content": {
|
|
106
|
-
"application/json": {
|
|
107
|
-
"example": {
|
|
108
|
-
"message": ""
|
|
109
|
-
},
|
|
110
|
-
"schema": {
|
|
111
|
-
"$ref": "#/components/schemas/Message"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
42
|
+
},
|
|
43
|
+
"example2": {
|
|
44
|
+
"value": {
|
|
45
|
+
"otherMessage": "",
|
|
46
|
+
"someNum": 0
|
|
114
47
|
}
|
|
48
|
+
}
|
|
115
49
|
}
|
|
50
|
+
}
|
|
116
51
|
}
|
|
52
|
+
}
|
|
117
53
|
},
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"content": {
|
|
125
|
-
"application/json": {
|
|
126
|
-
"schema": {
|
|
127
|
-
"type": "array",
|
|
128
|
-
"items": {
|
|
129
|
-
"$ref": "#/components/schemas/Message"
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"example": [
|
|
133
|
-
{
|
|
134
|
-
"message": ""
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
"summary": "Some resource",
|
|
142
|
-
"operationId": "Some resource",
|
|
143
|
-
"description": "",
|
|
144
|
-
"tags": [],
|
|
145
|
-
"parameters": []
|
|
146
|
-
}
|
|
147
|
-
}
|
|
54
|
+
"summary": "Some resource",
|
|
55
|
+
"operationId": "Some resource",
|
|
56
|
+
"description": "",
|
|
57
|
+
"tags": [],
|
|
58
|
+
"parameters": []
|
|
59
|
+
}
|
|
148
60
|
},
|
|
149
|
-
"
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
61
|
+
"/array/object": {
|
|
62
|
+
"post": {
|
|
63
|
+
"responses": {
|
|
64
|
+
"200": {
|
|
65
|
+
"description": "OK",
|
|
66
|
+
"headers": {},
|
|
67
|
+
"content": {
|
|
68
|
+
"application/json": {
|
|
69
|
+
"schema": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"items": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"required": [
|
|
74
|
+
"path"
|
|
75
|
+
],
|
|
76
|
+
"properties": {
|
|
77
|
+
"path": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"example": "/files"
|
|
80
|
+
},
|
|
81
|
+
"otherMessage": {
|
|
82
|
+
"$ref": "#/components/schemas/OtherMessage"
|
|
83
|
+
}
|
|
156
84
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"example": [
|
|
88
|
+
{
|
|
89
|
+
"path": "/files",
|
|
162
90
|
"otherMessage": {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"someNum": {
|
|
166
|
-
"type": "number"
|
|
91
|
+
"otherMessage": "",
|
|
92
|
+
"someNum": 0
|
|
167
93
|
}
|
|
168
|
-
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"summary": "Some resource",
|
|
101
|
+
"operationId": "Some resource",
|
|
102
|
+
"description": "",
|
|
103
|
+
"tags": [],
|
|
104
|
+
"parameters": [],
|
|
105
|
+
"requestBody": {
|
|
106
|
+
"content": {
|
|
107
|
+
"application/json": {
|
|
108
|
+
"example": {
|
|
109
|
+
"message": ""
|
|
110
|
+
},
|
|
111
|
+
"schema": {
|
|
112
|
+
"$ref": "#/components/schemas/Message"
|
|
113
|
+
}
|
|
169
114
|
}
|
|
115
|
+
}
|
|
170
116
|
}
|
|
117
|
+
}
|
|
171
118
|
},
|
|
172
|
-
"
|
|
119
|
+
"/messages": {
|
|
120
|
+
"get": {
|
|
121
|
+
"responses": {
|
|
122
|
+
"200": {
|
|
123
|
+
"description": "OK",
|
|
124
|
+
"headers": {},
|
|
125
|
+
"content": {
|
|
126
|
+
"application/json": {
|
|
127
|
+
"schema": {
|
|
128
|
+
"type": "array",
|
|
129
|
+
"items": {
|
|
130
|
+
"$ref": "#/components/schemas/Message"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"example": [
|
|
134
|
+
{
|
|
135
|
+
"message": ""
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"summary": "Some resource",
|
|
143
|
+
"operationId": "Some resource",
|
|
144
|
+
"description": "",
|
|
145
|
+
"tags": [],
|
|
146
|
+
"parameters": []
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"components": {
|
|
151
|
+
"schemas": {
|
|
152
|
+
"Message": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"properties": {
|
|
155
|
+
"message": {
|
|
156
|
+
"type": "string"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"OtherMessage": {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"properties": {
|
|
163
|
+
"otherMessage": {
|
|
164
|
+
"type": "string"
|
|
165
|
+
},
|
|
166
|
+
"someNum": {
|
|
167
|
+
"type": "number"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"tags": []
|
|
173
174
|
}
|
package/test/test.js
CHANGED
|
@@ -55,7 +55,8 @@ var remote = 'https://raw.githubusercontent.com/apiaryio/api-blueprint/format-1A
|
|
|
55
55
|
'OpenAPI3_headers.md',
|
|
56
56
|
'OpenAPI3_includes.md',
|
|
57
57
|
'OpenAPI3_attributes.md',
|
|
58
|
-
'OpenAPI3_Issue-#58.md'
|
|
58
|
+
'OpenAPI3_Issue-#58.md',
|
|
59
|
+
'OpenAPI3_Issue-#66.md'
|
|
59
60
|
];
|
|
60
61
|
|
|
61
62
|
var fetch = function (file) {
|