apib2swagger 1.15.0 → 1.17.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.
Files changed (73) hide show
  1. package/.github/workflows/nodejs.yml +1 -1
  2. package/.travis.yml +1 -1
  3. package/Dockerfile +1 -1
  4. package/README.md +1 -1
  5. package/package.json +1 -1
  6. package/src/mson_to_json_schema.js +1 -0
  7. package/src/requests.js +18 -3
  8. package/src/responses.js +7 -1
  9. package/test/input/Issue-#35.md +6 -0
  10. package/test/input/Issue-#72.md +43 -0
  11. package/test/output/01. Simplest API.json +2 -1
  12. package/test/output/01. Simplest API.ref.json +2 -1
  13. package/test/output/02. Resource and Actions.json +6 -2
  14. package/test/output/02. Resource and Actions.ref.json +6 -2
  15. package/test/output/03. Named Resource and Actions.json +6 -2
  16. package/test/output/03. Named Resource and Actions.ref.json +6 -2
  17. package/test/output/04. Grouping Resources.json +6 -2
  18. package/test/output/04. Grouping Resources.ref.json +6 -2
  19. package/test/output/05. Responses.json +17 -2
  20. package/test/output/05. Responses.ref.json +17 -2
  21. package/test/output/06. Requests.json +17 -1
  22. package/test/output/06. Requests.ref.json +17 -1
  23. package/test/output/07. Parameters.json +55 -2
  24. package/test/output/07. Parameters.ref.json +55 -2
  25. package/test/output/08. Attributes.json +2 -1
  26. package/test/output/08. Attributes.ref.json +2 -1
  27. package/test/output/09. Advanced Attributes.json +7 -2
  28. package/test/output/09. Advanced Attributes.ref.json +7 -2
  29. package/test/output/10. Data Structures.json +7 -2
  30. package/test/output/10. Data Structures.ref.json +7 -2
  31. package/test/output/11. Resource Model.json +6 -1
  32. package/test/output/11. Resource Model.ref.json +6 -1
  33. package/test/output/12. Advanced Action.json +69 -3
  34. package/test/output/12. Advanced Action.ref.json +69 -3
  35. package/test/output/13. Named Endpoints.json +6 -0
  36. package/test/output/13. Named Endpoints.ref.json +6 -0
  37. package/test/output/Attributes.json +3 -0
  38. package/test/output/Attributes.ref.json +3 -0
  39. package/test/output/Gist Fox API + Auth.json +76 -7
  40. package/test/output/Gist Fox API + Auth.ref.json +76 -7
  41. package/test/output/Issue-#15.json +6 -3
  42. package/test/output/Issue-#15.ref.json +6 -3
  43. package/test/output/Issue-#23.json +3 -0
  44. package/test/output/Issue-#23.ref.json +3 -0
  45. package/test/output/Issue-#26.json +5 -1
  46. package/test/output/Issue-#26.ref.json +5 -1
  47. package/test/output/Issue-#29.json +5 -1
  48. package/test/output/Issue-#29.ref.json +5 -1
  49. package/test/output/Issue-#33.json +2 -1
  50. package/test/output/Issue-#33.ref.json +2 -1
  51. package/test/output/Issue-#35.json +9 -0
  52. package/test/output/Issue-#35.ref.json +9 -0
  53. package/test/output/Issue-#36.json +2 -1
  54. package/test/output/Issue-#36.ref.json +2 -1
  55. package/test/output/Issue-#38.bearer.json +3 -0
  56. package/test/output/Issue-#38.json +3 -0
  57. package/test/output/Issue-#38.ref.json +3 -0
  58. package/test/output/Issue-#49.json +4 -2
  59. package/test/output/Issue-#49.ref.json +4 -2
  60. package/test/output/Issue-#57.json +3 -0
  61. package/test/output/Issue-#57.ref.json +3 -0
  62. package/test/output/Issue-#72.json +170 -0
  63. package/test/output/Issue-#72.ref.json +168 -0
  64. package/test/output/OpenAPI3_responses.json +240 -232
  65. package/test/output/OpenAPI3_responses.ref.json +231 -223
  66. package/test/output/Schema.json +20 -0
  67. package/test/output/Schema.ref.json +20 -0
  68. package/test/output/apiblueprint_uber.json +10 -5
  69. package/test/output/apiblueprint_uber.ref.json +10 -5
  70. package/test/output/apiblueprint_valid_simple.json +76 -7
  71. package/test/output/apiblueprint_valid_simple.ref.json +76 -7
  72. package/test/output/schema_without_body.json +52 -49
  73. package/test/output/schema_without_body.ref.json +52 -49
@@ -1,245 +1,253 @@
1
1
  {
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
- "/some/resource": {
15
- "get": {
16
- "responses": {
17
- "200": {
18
- "description": "Array schema",
19
- "headers": {
20
- "X-My-Message-Header": {
21
- "schema": {
22
- "type": "string"
23
- }
24
- }
25
- },
26
- "content": {
27
- "application/json": {
28
- "schema": {
29
- "oneOf": [
30
- {
31
- "type": "object",
32
- "properties": {
33
- "message": {
34
- "type": "string",
35
- "description": "This is the message description "
36
- }
37
- }
38
- },
39
- {
40
- "type": "object",
41
- "properties": {
42
- "other": {
43
- "type": "string",
44
- "description": "This is the message description "
45
- }
46
- }
47
- },
48
- {
49
- "type": "array",
50
- "items": {
51
- "type": "object",
52
- "properties": {
53
- "message": {
54
- "type": "string",
55
- "description": "This is the message description "
56
- }
57
- }
58
- }
59
- }
60
- ]
61
- },
62
- "examples": {
63
- "example1": {
64
- "value": {
65
- "message": "Hello World!"
66
- }
67
- },
68
- "example2": {
69
- "value": {
70
- "other": "Hello World!"
71
- }
72
- },
73
- "example3": {
74
- "value": {
75
- "other": "Hello World!"
76
- }
77
- },
78
- "example4": {
79
- "value": [
80
- {
81
- "message": "Hello World!"
82
- }
83
- ]
84
- }
85
- }
86
- }
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
+ "/some/resource": {
15
+ "get": {
16
+ "responses": {
17
+ "200": {
18
+ "description": "Array schema",
19
+ "headers": {
20
+ "X-My-Message-Header": {
21
+ "schema": {
22
+ "type": "string"
23
+ }
24
+ }
25
+ },
26
+ "content": {
27
+ "application/json": {
28
+ "schema": {
29
+ "oneOf": [
30
+ {
31
+ "type": "object",
32
+ "properties": {
33
+ "message": {
34
+ "type": "string",
35
+ "description": "This is the message description "
87
36
  }
37
+ }
88
38
  },
89
- "400": {
90
- "description": "Bad Request",
91
- "headers": {},
92
- "content": {
93
- "application/json": {
94
- "example": {
95
- "message": "Invalid data"
96
- }
97
- }
39
+ {
40
+ "type": "object",
41
+ "properties": {
42
+ "other": {
43
+ "type": "string",
44
+ "description": "This is the message description "
98
45
  }
99
- }
100
- },
101
- "summary": "Some resource",
102
- "operationId": "Some resource",
103
- "description": "",
104
- "tags": [],
105
- "parameters": []
106
- },
107
- "post": {
108
- "responses": {
109
- "200": {
110
- "description": "OK",
111
- "headers": {
112
- "X-My-Message-Header": {
113
- "schema": {
114
- "type": "string"
115
- }
116
- }
117
- },
118
- "content": {
119
- "application/json": {
120
- "schema": {
121
- "type": "object",
122
- "properties": {
123
- "message": {
124
- "type": "string",
125
- "description": "This is the message description "
126
- }
127
- }
128
- },
129
- "examples": {
130
- "example1": {
131
- "value": {
132
- "message": "Hello World!"
133
- }
134
- },
135
- "example2": {
136
- "value": {
137
- "message": "Hello World!"
138
- }
139
- }
140
- }
141
- }
46
+ }
47
+ },
48
+ {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "object",
52
+ "properties": {
53
+ "message": {
54
+ "type": "string",
55
+ "description": "This is the message description "
56
+ }
142
57
  }
58
+ }
143
59
  }
60
+ ]
144
61
  },
145
- "summary": "Some resource",
146
- "operationId": "Some resource",
147
- "description": "",
148
- "tags": [],
149
- "parameters": []
62
+ "examples": {
63
+ "example1": {
64
+ "value": {
65
+ "message": "Hello World!"
66
+ }
67
+ },
68
+ "example2": {
69
+ "value": {
70
+ "other": "Hello World!"
71
+ }
72
+ },
73
+ "example3": {
74
+ "value": {
75
+ "other": "Hello World!"
76
+ }
77
+ },
78
+ "example4": {
79
+ "value": [
80
+ {
81
+ "message": "Hello World!"
82
+ }
83
+ ]
84
+ }
85
+ }
86
+ }
150
87
  }
151
- },
152
- "/test/attributes": {
153
- "get": {
154
- "responses": {
155
- "200": {
156
- "description": "OK",
157
- "headers": {},
158
- "content": {
159
- "application/json": {
160
- "schema": {
161
- "oneOf": [
162
- {
163
- "$ref": "#/components/schemas/Message"
164
- },
165
- {
166
- "$ref": "#/components/schemas/OtherMessage"
167
- }
168
- ]
169
- },
170
- "examples": {
171
- "example1": {
172
- "value": {
173
- "message": "Hello World!"
174
- }
175
- },
176
- "example2": {
177
- "value": {
178
- "message": "Hello World2"
179
- }
180
- },
181
- "example3": {
182
- "value": {
183
- "otherMessage": "Hello World!"
184
- }
185
- }
186
- }
187
- }
188
- }
88
+ },
89
+ "400": {
90
+ "description": "Bad Request",
91
+ "headers": {},
92
+ "content": {
93
+ "application/json": {
94
+ "schema": {
95
+ "type": "object",
96
+ "properties": {
97
+ "message": {
98
+ "type": "string"
189
99
  }
100
+ }
190
101
  },
191
- "summary": "Some resource",
192
- "operationId": "Some resource",
193
- "description": "",
194
- "tags": [],
195
- "parameters": []
102
+ "example": {
103
+ "message": "Invalid data"
104
+ }
105
+ }
196
106
  }
107
+ }
197
108
  },
198
- "/message": {
199
- "get": {
200
- "responses": {
201
- "200": {
202
- "description": "Unparsable schema should fall back to Attributes",
203
- "headers": {},
204
- "content": {
205
- "application/json": {
206
- "schema": {
207
- "$ref": "#/components/schemas/Message"
208
- },
209
- "example": {
210
- "message": ""
211
- }
212
- }
213
- }
109
+ "summary": "Some resource",
110
+ "operationId": "Some resource",
111
+ "description": "",
112
+ "tags": [],
113
+ "parameters": []
114
+ },
115
+ "post": {
116
+ "responses": {
117
+ "200": {
118
+ "description": "OK",
119
+ "headers": {
120
+ "X-My-Message-Header": {
121
+ "schema": {
122
+ "type": "string"
123
+ }
124
+ }
125
+ },
126
+ "content": {
127
+ "application/json": {
128
+ "schema": {
129
+ "type": "object",
130
+ "properties": {
131
+ "message": {
132
+ "type": "string",
133
+ "description": "This is the message description "
214
134
  }
135
+ }
215
136
  },
216
- "summary": "Message",
217
- "operationId": "Message",
218
- "description": "",
219
- "tags": [],
220
- "parameters": []
137
+ "examples": {
138
+ "example1": {
139
+ "value": {
140
+ "message": "Hello World!"
141
+ }
142
+ },
143
+ "example2": {
144
+ "value": {
145
+ "message": "Hello World!"
146
+ }
147
+ }
148
+ }
149
+ }
221
150
  }
222
- }
151
+ }
152
+ },
153
+ "summary": "Some resource",
154
+ "operationId": "Some resource",
155
+ "description": "",
156
+ "tags": [],
157
+ "parameters": []
158
+ }
223
159
  },
224
- "components": {
225
- "schemas":{
226
- "Message": {
227
- "type": "object",
228
- "properties": {
229
- "message": {
230
- "type": "string"
160
+ "/test/attributes": {
161
+ "get": {
162
+ "responses": {
163
+ "200": {
164
+ "description": "OK",
165
+ "headers": {},
166
+ "content": {
167
+ "application/json": {
168
+ "schema": {
169
+ "oneOf": [
170
+ {
171
+ "$ref": "#/components/schemas/Message"
172
+ },
173
+ {
174
+ "$ref": "#/components/schemas/OtherMessage"
231
175
  }
232
- }
233
- },
234
- "OtherMessage": {
235
- "type": "object",
236
- "properties": {
237
- "otherMessage": {
238
- "type": "string"
176
+ ]
177
+ },
178
+ "examples": {
179
+ "example1": {
180
+ "value": {
181
+ "message": "Hello World!"
239
182
  }
183
+ },
184
+ "example2": {
185
+ "value": {
186
+ "message": "Hello World2"
187
+ }
188
+ },
189
+ "example3": {
190
+ "value": {
191
+ "otherMessage": "Hello World!"
192
+ }
193
+ }
240
194
  }
195
+ }
241
196
  }
242
- }
197
+ }
198
+ },
199
+ "summary": "Some resource",
200
+ "operationId": "Some resource",
201
+ "description": "",
202
+ "tags": [],
203
+ "parameters": []
204
+ }
243
205
  },
244
- "tags": []
206
+ "/message": {
207
+ "get": {
208
+ "responses": {
209
+ "200": {
210
+ "description": "Unparsable schema should fall back to Attributes",
211
+ "headers": {},
212
+ "content": {
213
+ "application/json": {
214
+ "schema": {
215
+ "$ref": "#/components/schemas/Message"
216
+ },
217
+ "example": {
218
+ "message": ""
219
+ }
220
+ }
221
+ }
222
+ }
223
+ },
224
+ "summary": "Message",
225
+ "operationId": "Message",
226
+ "description": "",
227
+ "tags": [],
228
+ "parameters": []
229
+ }
230
+ }
231
+ },
232
+ "components": {
233
+ "schemas": {
234
+ "Message": {
235
+ "type": "object",
236
+ "properties": {
237
+ "message": {
238
+ "type": "string"
239
+ }
240
+ }
241
+ },
242
+ "OtherMessage": {
243
+ "type": "object",
244
+ "properties": {
245
+ "otherMessage": {
246
+ "type": "string"
247
+ }
248
+ }
249
+ }
250
+ }
251
+ },
252
+ "tags": []
245
253
  }
@@ -46,6 +46,9 @@
46
46
  }
47
47
  }
48
48
  }
49
+ ],
50
+ "consumes": [
51
+ "application/json"
49
52
  ]
50
53
  }
51
54
  },
@@ -86,6 +89,9 @@
86
89
  }
87
90
  }
88
91
  }
92
+ ],
93
+ "consumes": [
94
+ "application/json"
89
95
  ]
90
96
  }
91
97
  },
@@ -99,6 +105,17 @@
99
105
  "application/json": {
100
106
  "prop1": "a string"
101
107
  }
108
+ },
109
+ "schema": {
110
+ "type": "object",
111
+ "properties": {
112
+ "prop1": {
113
+ "type": "string"
114
+ }
115
+ },
116
+ "example": {
117
+ "prop1": "a string"
118
+ }
102
119
  }
103
120
  }
104
121
  },
@@ -162,6 +179,9 @@
162
179
  ],
163
180
  "produces": [
164
181
  "application/json"
182
+ ],
183
+ "consumes": [
184
+ "application/json"
165
185
  ]
166
186
  }
167
187
  }
@@ -46,6 +46,9 @@
46
46
  }
47
47
  }
48
48
  }
49
+ ],
50
+ "consumes": [
51
+ "application/json"
49
52
  ]
50
53
  }
51
54
  },
@@ -81,6 +84,9 @@
81
84
  }
82
85
  }
83
86
  }
87
+ ],
88
+ "consumes": [
89
+ "application/json"
84
90
  ]
85
91
  }
86
92
  },
@@ -94,6 +100,17 @@
94
100
  "application/json": {
95
101
  "prop1": "a string"
96
102
  }
103
+ },
104
+ "schema": {
105
+ "type": "object",
106
+ "properties": {
107
+ "prop1": {
108
+ "type": "string"
109
+ }
110
+ },
111
+ "example": {
112
+ "prop1": "a string"
113
+ }
97
114
  }
98
115
  }
99
116
  },
@@ -157,6 +174,9 @@
157
174
  ],
158
175
  "produces": [
159
176
  "application/json"
177
+ ],
178
+ "consumes": [
179
+ "application/json"
160
180
  ]
161
181
  }
162
182
  }
@@ -68,7 +68,8 @@
68
68
  "type": "string"
69
69
  }
70
70
  }
71
- ]
71
+ ],
72
+ "consumes": []
72
73
  }
73
74
  },
74
75
  "/v1/estimates/price": {
@@ -159,7 +160,8 @@
159
160
  "type": "string"
160
161
  }
161
162
  }
162
- ]
163
+ ],
164
+ "consumes": []
163
165
  }
164
166
  },
165
167
  "/v1/estimates/time": {
@@ -242,7 +244,8 @@
242
244
  "type": "string"
243
245
  }
244
246
  }
245
- ]
247
+ ],
248
+ "consumes": []
246
249
  }
247
250
  },
248
251
  "/v1/me": {
@@ -285,7 +288,8 @@
285
288
  "tags": [
286
289
  "User"
287
290
  ],
288
- "parameters": []
291
+ "parameters": [],
292
+ "consumes": []
289
293
  }
290
294
  },
291
295
  "/v1/history": {
@@ -354,7 +358,8 @@
354
358
  "type": "string"
355
359
  }
356
360
  }
357
- ]
361
+ ],
362
+ "consumes": []
358
363
  }
359
364
  }
360
365
  },
@@ -68,7 +68,8 @@
68
68
  "type": "string"
69
69
  }
70
70
  }
71
- ]
71
+ ],
72
+ "consumes": []
72
73
  }
73
74
  },
74
75
  "/v1/estimates/price": {
@@ -159,7 +160,8 @@
159
160
  "type": "string"
160
161
  }
161
162
  }
162
- ]
163
+ ],
164
+ "consumes": []
163
165
  }
164
166
  },
165
167
  "/v1/estimates/time": {
@@ -242,7 +244,8 @@
242
244
  "type": "string"
243
245
  }
244
246
  }
245
- ]
247
+ ],
248
+ "consumes": []
246
249
  }
247
250
  },
248
251
  "/v1/me": {
@@ -285,7 +288,8 @@
285
288
  "tags": [
286
289
  "User"
287
290
  ],
288
- "parameters": []
291
+ "parameters": [],
292
+ "consumes": []
289
293
  }
290
294
  },
291
295
  "/v1/history": {
@@ -354,7 +358,8 @@
354
358
  "type": "string"
355
359
  }
356
360
  }
357
- ]
361
+ ],
362
+ "consumes": []
358
363
  }
359
364
  }
360
365
  },