apib2swagger 1.14.3 → 1.16.1

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 (36) hide show
  1. package/.github/workflows/nodejs.yml +1 -1
  2. package/.travis.yml +1 -1
  3. package/README.md +1 -1
  4. package/package.json +3 -3
  5. package/src/mson_to_json_schema.js +4 -0
  6. package/src/responses.js +7 -1
  7. package/test/input/Issue-#35.md +6 -0
  8. package/test/output/05. Responses.json +11 -0
  9. package/test/output/05. Responses.ref.json +11 -0
  10. package/test/output/06. Requests.json +11 -0
  11. package/test/output/06. Requests.ref.json +11 -0
  12. package/test/output/07. Parameters.json +47 -0
  13. package/test/output/07. Parameters.ref.json +47 -0
  14. package/test/output/08. Attributes.ref.json +4 -1
  15. package/test/output/09. Advanced Attributes.json +6 -2
  16. package/test/output/09. Advanced Attributes.ref.json +6 -2
  17. package/test/output/10. Data Structures.json +4 -1
  18. package/test/output/10. Data Structures.ref.json +4 -1
  19. package/test/output/12. Advanced Action.json +63 -0
  20. package/test/output/12. Advanced Action.ref.json +63 -0
  21. package/test/output/Gist Fox API + Auth.json +51 -0
  22. package/test/output/Gist Fox API + Auth.ref.json +51 -0
  23. package/test/output/Issue-#15.json +12 -1
  24. package/test/output/Issue-#15.ref.json +16 -3
  25. package/test/output/Issue-#29.json +12 -6
  26. package/test/output/Issue-#29.ref.json +12 -6
  27. package/test/output/Issue-#33.ref.json +2 -0
  28. package/test/output/Issue-#35.json +9 -0
  29. package/test/output/Issue-#35.ref.json +9 -0
  30. package/test/output/OpenAPI3_attributes.ref.json +157 -156
  31. package/test/output/OpenAPI3_responses.json +240 -232
  32. package/test/output/OpenAPI3_responses.ref.json +231 -223
  33. package/test/output/Schema.json +11 -0
  34. package/test/output/Schema.ref.json +11 -0
  35. package/test/output/apiblueprint_valid_simple.json +51 -0
  36. package/test/output/apiblueprint_valid_simple.ref.json +51 -0
@@ -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
  }
@@ -99,6 +99,17 @@
99
99
  "application/json": {
100
100
  "prop1": "a string"
101
101
  }
102
+ },
103
+ "schema": {
104
+ "type": "object",
105
+ "properties": {
106
+ "prop1": {
107
+ "type": "string"
108
+ }
109
+ },
110
+ "example": {
111
+ "prop1": "a string"
112
+ }
102
113
  }
103
114
  }
104
115
  },
@@ -94,6 +94,17 @@
94
94
  "application/json": {
95
95
  "prop1": "a string"
96
96
  }
97
+ },
98
+ "schema": {
99
+ "type": "object",
100
+ "properties": {
101
+ "prop1": {
102
+ "type": "string"
103
+ }
104
+ },
105
+ "example": {
106
+ "prop1": "a string"
107
+ }
97
108
  }
98
109
  }
99
110
  },
@@ -31,6 +31,57 @@
31
31
  }
32
32
  }
33
33
  }
34
+ },
35
+ "schema": {
36
+ "type": "object",
37
+ "properties": {
38
+ "_links": {
39
+ "type": "object",
40
+ "properties": {
41
+ "self": {
42
+ "type": "object",
43
+ "properties": {
44
+ "href": {
45
+ "type": "string"
46
+ }
47
+ }
48
+ },
49
+ "gists": {
50
+ "type": "object",
51
+ "properties": {
52
+ "href": {
53
+ "type": "string"
54
+ },
55
+ "templated": {
56
+ "type": "boolean"
57
+ }
58
+ }
59
+ },
60
+ "authorization": {
61
+ "type": "object",
62
+ "properties": {
63
+ "href": {
64
+ "type": "string"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "example": {
72
+ "_links": {
73
+ "self": {
74
+ "href": "/"
75
+ },
76
+ "gists": {
77
+ "href": "/gists?{since}",
78
+ "templated": true
79
+ },
80
+ "authorization": {
81
+ "href": "/authorization"
82
+ }
83
+ }
84
+ }
34
85
  }
35
86
  }
36
87
  },
@@ -31,6 +31,57 @@
31
31
  }
32
32
  }
33
33
  }
34
+ },
35
+ "schema": {
36
+ "type": "object",
37
+ "properties": {
38
+ "_links": {
39
+ "type": "object",
40
+ "properties": {
41
+ "self": {
42
+ "type": "object",
43
+ "properties": {
44
+ "href": {
45
+ "type": "string"
46
+ }
47
+ }
48
+ },
49
+ "gists": {
50
+ "type": "object",
51
+ "properties": {
52
+ "href": {
53
+ "type": "string"
54
+ },
55
+ "templated": {
56
+ "type": "boolean"
57
+ }
58
+ }
59
+ },
60
+ "authorization": {
61
+ "type": "object",
62
+ "properties": {
63
+ "href": {
64
+ "type": "string"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "example": {
72
+ "_links": {
73
+ "self": {
74
+ "href": "/"
75
+ },
76
+ "gists": {
77
+ "href": "/gists?{since}",
78
+ "templated": true
79
+ },
80
+ "authorization": {
81
+ "href": "/authorization"
82
+ }
83
+ }
84
+ }
34
85
  }
35
86
  }
36
87
  },