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
@@ -0,0 +1,168 @@
1
+ {
2
+ "swagger": "2.0",
3
+ "info": {
4
+ "title": "",
5
+ "version": "",
6
+ "description": ""
7
+ },
8
+ "paths": {
9
+ "/api/scim/v2/Users": {
10
+ "post": {
11
+ "responses": {
12
+ "201": {
13
+ "description": "Created",
14
+ "headers": {},
15
+ "examples": {
16
+ "application/scim+json": {}
17
+ },
18
+ "schema": {
19
+ "$ref": "#/definitions/ExistingUser"
20
+ }
21
+ }
22
+ },
23
+ "summary": "Create a user",
24
+ "operationId": "Create a user",
25
+ "description": "",
26
+ "tags": [],
27
+ "parameters": [
28
+ {
29
+ "name": "body",
30
+ "in": "body",
31
+ "schema": {
32
+ "type": "object",
33
+ "properties": {
34
+ "schemas": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "string"
38
+ }
39
+ },
40
+ "userName": {
41
+ "type": "string"
42
+ },
43
+ "name": {
44
+ "type": "object",
45
+ "properties": {
46
+ "givenName": {
47
+ "type": "string"
48
+ },
49
+ "familyName": {
50
+ "type": "string"
51
+ }
52
+ }
53
+ },
54
+ "emails": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "object",
58
+ "properties": {
59
+ "primary": {
60
+ "type": "boolean"
61
+ },
62
+ "value": {
63
+ "type": "string"
64
+ },
65
+ "type": {
66
+ "type": "string"
67
+ }
68
+ }
69
+ }
70
+ },
71
+ "displayName": {
72
+ "type": "string"
73
+ },
74
+ "externalId": {
75
+ "type": "string"
76
+ },
77
+ "active": {
78
+ "type": "boolean"
79
+ }
80
+ },
81
+ "example": {
82
+ "schemas": [
83
+ "urn:ietf:params:scim:schemas:core:2.0:User"
84
+ ],
85
+ "userName": "fredsmith",
86
+ "name": {
87
+ "givenName": "Fred",
88
+ "familyName": "Smith"
89
+ },
90
+ "emails": [
91
+ {
92
+ "primary": true,
93
+ "value": "fred@example.com",
94
+ "type": "work"
95
+ }
96
+ ],
97
+ "displayName": "Fred Smith",
98
+ "externalId": "fred-external-id",
99
+ "active": true
100
+ }
101
+ }
102
+ }
103
+ ],
104
+ "produces": [
105
+ "application/scim+json"
106
+ ],
107
+ "consumes": [
108
+ "application/scim+json"
109
+ ],
110
+ "security": [
111
+ {
112
+ "oauth2": []
113
+ }
114
+ ]
115
+ }
116
+ },
117
+ "/api2/scim/v2/Users": {
118
+ "post": {
119
+ "responses": {
120
+ "201": {
121
+ "description": "Created",
122
+ "headers": {},
123
+ "examples": {
124
+ "application/scim+json": {}
125
+ },
126
+ "schema": {
127
+ "$ref": "#/definitions/ExistingUser"
128
+ }
129
+ }
130
+ },
131
+ "summary": "Create a user 2",
132
+ "operationId": "Create a user 2",
133
+ "description": "",
134
+ "tags": [],
135
+ "parameters": [],
136
+ "produces": [
137
+ "application/scim+json"
138
+ ],
139
+ "consumes": [
140
+ "application/scim+json"
141
+ ],
142
+ "security": [
143
+ {
144
+ "oauth2": []
145
+ }
146
+ ]
147
+ }
148
+ }
149
+ },
150
+ "definitions": {
151
+ "Create a user": {},
152
+ "Create a user 2": {},
153
+ "ExistingUser": {
154
+ "type": "object",
155
+ "properties": {}
156
+ }
157
+ },
158
+ "securityDefinitions": {
159
+ "oauth2": {
160
+ "type": "oauth2",
161
+ "flow": "accessCode",
162
+ "authorizationUrl": "",
163
+ "tokenUrl": "",
164
+ "scopes": {}
165
+ }
166
+ },
167
+ "tags": []
168
+ }
@@ -1,255 +1,263 @@
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 "
36
+ }
37
+ }
38
+ },
39
+ {
40
+ "type": "object",
41
+ "properties": {
42
+ "other": {
43
+ "type": "string",
44
+ "description": "This is the message description "
87
45
  }
46
+ }
88
47
  },
89
- "400": {
90
- "description": "Bad Request",
91
- "headers": {},
92
- "content": {
93
- "application/json": {
94
- "example": {
95
- "message": "Invalid data"
96
- }
97
- }
48
+ {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "object",
52
+ "properties": {
53
+ "message": {
54
+ "type": "string",
55
+ "description": "This is the message description "
56
+ }
98
57
  }
58
+ }
99
59
  }
60
+ ]
100
61
  },
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
- }
142
- }
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!"
143
76
  }
77
+ },
78
+ "example4": {
79
+ "value": [
80
+ {
81
+ "message": "Hello World!"
82
+ }
83
+ ]
84
+ }
85
+ }
86
+ }
87
+ }
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"
99
+ }
100
+ }
144
101
  },
145
- "summary": "Some resource",
146
- "operationId": "Some resource",
147
- "description": "",
148
- "tags": [],
149
- "parameters": []
102
+ "example": {
103
+ "message": "Invalid data"
104
+ }
105
+ }
150
106
  }
107
+ }
151
108
  },
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
- "type": "object",
164
- "properties": {
165
- "message": {
166
- "type": "string"
167
- }
168
- }
169
- },
170
- {
171
- "type": "object",
172
- "properties": {
173
- "otherMessage": {
174
- "type": "string"
175
- }
176
- }
177
- }
178
- ]
179
- },
180
- "examples": {
181
- "example1": {
182
- "value": {
183
- "message": "Hello World!"
184
- }
185
- },
186
- "example2": {
187
- "value": {
188
- "message": "Hello World2"
189
- }
190
- },
191
- "example3": {
192
- "value": {
193
- "otherMessage": "Hello World!"
194
- }
195
- }
196
- }
197
- }
198
- }
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 "
199
134
  }
135
+ }
200
136
  },
201
- "summary": "Some resource",
202
- "operationId": "Some resource",
203
- "description": "",
204
- "tags": [],
205
- "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
+ }
206
150
  }
151
+ }
207
152
  },
208
- "/message": {
209
- "get": {
210
- "responses": {
211
- "200": {
212
- "description": "Unparsable schema should fall back to Attributes",
213
- "headers": {},
214
- "content": {
215
- "application/json": {
216
- "schema": {
217
- "$ref": "#/components/schemas/Message"
218
- },
219
- "example": {
220
- "message": ""
221
- }
222
- }
153
+ "summary": "Some resource",
154
+ "operationId": "Some resource",
155
+ "description": "",
156
+ "tags": [],
157
+ "parameters": []
158
+ }
159
+ },
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
+ "type": "object",
172
+ "properties": {
173
+ "message": {
174
+ "type": "string"
175
+ }
176
+ }
177
+ },
178
+ {
179
+ "type": "object",
180
+ "properties": {
181
+ "otherMessage": {
182
+ "type": "string"
223
183
  }
184
+ }
224
185
  }
186
+ ]
225
187
  },
226
- "summary": "Message",
227
- "operationId": "Message",
228
- "description": "",
229
- "tags": [],
230
- "parameters": []
231
- }
232
- }
233
- },
234
- "components": {
235
- "schemas":{
236
- "Message": {
237
- "type": "object",
238
- "properties": {
239
- "message": {
240
- "type": "string"
188
+ "examples": {
189
+ "example1": {
190
+ "value": {
191
+ "message": "Hello World!"
241
192
  }
242
- }
243
- },
244
- "OtherMessage": {
245
- "type": "object",
246
- "properties": {
247
- "otherMessage": {
248
- "type": "string"
193
+ },
194
+ "example2": {
195
+ "value": {
196
+ "message": "Hello World2"
197
+ }
198
+ },
199
+ "example3": {
200
+ "value": {
201
+ "otherMessage": "Hello World!"
249
202
  }
203
+ }
250
204
  }
205
+ }
251
206
  }
252
- }
207
+ }
208
+ },
209
+ "summary": "Some resource",
210
+ "operationId": "Some resource",
211
+ "description": "",
212
+ "tags": [],
213
+ "parameters": []
214
+ }
253
215
  },
254
- "tags": []
216
+ "/message": {
217
+ "get": {
218
+ "responses": {
219
+ "200": {
220
+ "description": "Unparsable schema should fall back to Attributes",
221
+ "headers": {},
222
+ "content": {
223
+ "application/json": {
224
+ "schema": {
225
+ "$ref": "#/components/schemas/Message"
226
+ },
227
+ "example": {
228
+ "message": ""
229
+ }
230
+ }
231
+ }
232
+ }
233
+ },
234
+ "summary": "Message",
235
+ "operationId": "Message",
236
+ "description": "",
237
+ "tags": [],
238
+ "parameters": []
239
+ }
240
+ }
241
+ },
242
+ "components": {
243
+ "schemas": {
244
+ "Message": {
245
+ "type": "object",
246
+ "properties": {
247
+ "message": {
248
+ "type": "string"
249
+ }
250
+ }
251
+ },
252
+ "OtherMessage": {
253
+ "type": "object",
254
+ "properties": {
255
+ "otherMessage": {
256
+ "type": "string"
257
+ }
258
+ }
259
+ }
260
+ }
261
+ },
262
+ "tags": []
255
263
  }