apib2swagger 1.16.1 → 1.17.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 (71) hide show
  1. package/.github/workflows/nodejs.yml +1 -1
  2. package/Dockerfile +1 -1
  3. package/README.md +1 -1
  4. package/package.json +1 -1
  5. package/src/mson_to_json_schema.js +28 -9
  6. package/src/requests.js +18 -3
  7. package/src/responses.js +13 -1
  8. package/test/input/Issue-#72.md +43 -0
  9. package/test/input/OpenAPI3_Issue-#73.md +21 -0
  10. package/test/output/01. Simplest API.json +2 -1
  11. package/test/output/01. Simplest API.ref.json +2 -1
  12. package/test/output/02. Resource and Actions.json +6 -2
  13. package/test/output/02. Resource and Actions.ref.json +6 -2
  14. package/test/output/03. Named Resource and Actions.json +6 -2
  15. package/test/output/03. Named Resource and Actions.ref.json +6 -2
  16. package/test/output/04. Grouping Resources.json +6 -2
  17. package/test/output/04. Grouping Resources.ref.json +6 -2
  18. package/test/output/05. Responses.json +6 -2
  19. package/test/output/05. Responses.ref.json +6 -2
  20. package/test/output/06. Requests.json +6 -1
  21. package/test/output/06. Requests.ref.json +6 -1
  22. package/test/output/07. Parameters.json +8 -2
  23. package/test/output/07. Parameters.ref.json +8 -2
  24. package/test/output/08. Attributes.json +2 -1
  25. package/test/output/08. Attributes.ref.json +2 -1
  26. package/test/output/09. Advanced Attributes.json +7 -2
  27. package/test/output/09. Advanced Attributes.ref.json +7 -2
  28. package/test/output/10. Data Structures.json +7 -2
  29. package/test/output/10. Data Structures.ref.json +7 -2
  30. package/test/output/11. Resource Model.json +6 -1
  31. package/test/output/11. Resource Model.ref.json +6 -1
  32. package/test/output/12. Advanced Action.json +6 -3
  33. package/test/output/12. Advanced Action.ref.json +6 -3
  34. package/test/output/13. Named Endpoints.json +6 -0
  35. package/test/output/13. Named Endpoints.ref.json +6 -0
  36. package/test/output/Attributes.json +3 -0
  37. package/test/output/Attributes.ref.json +3 -0
  38. package/test/output/Gist Fox API + Auth.json +25 -7
  39. package/test/output/Gist Fox API + Auth.ref.json +25 -7
  40. package/test/output/Issue-#15.json +6 -3
  41. package/test/output/Issue-#15.ref.json +6 -3
  42. package/test/output/Issue-#23.json +3 -0
  43. package/test/output/Issue-#23.ref.json +3 -0
  44. package/test/output/Issue-#26.json +5 -1
  45. package/test/output/Issue-#26.ref.json +5 -1
  46. package/test/output/Issue-#29.json +5 -1
  47. package/test/output/Issue-#29.ref.json +5 -1
  48. package/test/output/Issue-#33.json +2 -1
  49. package/test/output/Issue-#33.ref.json +2 -1
  50. package/test/output/Issue-#36.json +2 -1
  51. package/test/output/Issue-#36.ref.json +2 -1
  52. package/test/output/Issue-#38.bearer.json +3 -0
  53. package/test/output/Issue-#38.json +3 -0
  54. package/test/output/Issue-#38.ref.json +3 -0
  55. package/test/output/Issue-#49.json +4 -2
  56. package/test/output/Issue-#49.ref.json +4 -2
  57. package/test/output/Issue-#57.json +3 -0
  58. package/test/output/Issue-#57.ref.json +3 -0
  59. package/test/output/Issue-#72.json +170 -0
  60. package/test/output/Issue-#72.ref.json +168 -0
  61. package/test/output/OpenAPI3_Issue-#73.json +69 -0
  62. package/test/output/OpenAPI3_Issue-#73.ref.json +63 -0
  63. package/test/output/Schema.json +9 -0
  64. package/test/output/Schema.ref.json +9 -0
  65. package/test/output/apiblueprint_uber.json +10 -5
  66. package/test/output/apiblueprint_uber.ref.json +10 -5
  67. package/test/output/apiblueprint_valid_simple.json +25 -7
  68. package/test/output/apiblueprint_valid_simple.ref.json +25 -7
  69. package/test/output/schema_without_body.json +52 -49
  70. package/test/output/schema_without_body.ref.json +52 -49
  71. package/test/test.js +3 -1
@@ -37,7 +37,8 @@
37
37
  "parameters": [],
38
38
  "produces": [
39
39
  "application/json"
40
- ]
40
+ ],
41
+ "consumes": []
41
42
  }
42
43
  },
43
44
  "/users": {
@@ -74,7 +75,8 @@
74
75
  "parameters": [],
75
76
  "produces": [
76
77
  "application/json"
77
- ]
78
+ ],
79
+ "consumes": []
78
80
  }
79
81
  }
80
82
  },
@@ -34,6 +34,9 @@
34
34
  ]
35
35
  }
36
36
  }
37
+ ],
38
+ "consumes": [
39
+ "application/json"
37
40
  ]
38
41
  }
39
42
  }
@@ -34,6 +34,9 @@
34
34
  ]
35
35
  }
36
36
  }
37
+ ],
38
+ "consumes": [
39
+ "application/json"
37
40
  ]
38
41
  }
39
42
  }
@@ -0,0 +1,170 @@
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
+ "type": "object",
20
+ "properties": {}
21
+ }
22
+ }
23
+ },
24
+ "summary": "Create a user",
25
+ "operationId": "Create a user",
26
+ "description": "",
27
+ "tags": [],
28
+ "parameters": [
29
+ {
30
+ "name": "body",
31
+ "in": "body",
32
+ "schema": {
33
+ "type": "object",
34
+ "properties": {
35
+ "schemas": {
36
+ "type": "array",
37
+ "items": {
38
+ "type": "string"
39
+ }
40
+ },
41
+ "userName": {
42
+ "type": "string"
43
+ },
44
+ "name": {
45
+ "type": "object",
46
+ "properties": {
47
+ "givenName": {
48
+ "type": "string"
49
+ },
50
+ "familyName": {
51
+ "type": "string"
52
+ }
53
+ }
54
+ },
55
+ "emails": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "object",
59
+ "properties": {
60
+ "primary": {
61
+ "type": "boolean"
62
+ },
63
+ "value": {
64
+ "type": "string"
65
+ },
66
+ "type": {
67
+ "type": "string"
68
+ }
69
+ }
70
+ }
71
+ },
72
+ "displayName": {
73
+ "type": "string"
74
+ },
75
+ "externalId": {
76
+ "type": "string"
77
+ },
78
+ "active": {
79
+ "type": "boolean"
80
+ }
81
+ },
82
+ "example": {
83
+ "schemas": [
84
+ "urn:ietf:params:scim:schemas:core:2.0:User"
85
+ ],
86
+ "userName": "fredsmith",
87
+ "name": {
88
+ "givenName": "Fred",
89
+ "familyName": "Smith"
90
+ },
91
+ "emails": [
92
+ {
93
+ "primary": true,
94
+ "value": "fred@example.com",
95
+ "type": "work"
96
+ }
97
+ ],
98
+ "displayName": "Fred Smith",
99
+ "externalId": "fred-external-id",
100
+ "active": true
101
+ }
102
+ }
103
+ }
104
+ ],
105
+ "produces": [
106
+ "application/scim+json"
107
+ ],
108
+ "consumes": [
109
+ "application/scim+json"
110
+ ],
111
+ "security": [
112
+ {
113
+ "oauth2": []
114
+ }
115
+ ]
116
+ }
117
+ },
118
+ "/api2/scim/v2/Users": {
119
+ "post": {
120
+ "responses": {
121
+ "201": {
122
+ "description": "Created",
123
+ "headers": {},
124
+ "examples": {
125
+ "application/scim+json": {}
126
+ },
127
+ "schema": {
128
+ "type": "object",
129
+ "properties": {}
130
+ }
131
+ }
132
+ },
133
+ "summary": "Create a user 2",
134
+ "operationId": "Create a user 2",
135
+ "description": "",
136
+ "tags": [],
137
+ "parameters": [],
138
+ "produces": [
139
+ "application/scim+json"
140
+ ],
141
+ "consumes": [
142
+ "application/scim+json"
143
+ ],
144
+ "security": [
145
+ {
146
+ "oauth2": []
147
+ }
148
+ ]
149
+ }
150
+ }
151
+ },
152
+ "definitions": {
153
+ "Create a user": {},
154
+ "Create a user 2": {},
155
+ "ExistingUser": {
156
+ "type": "object",
157
+ "properties": {}
158
+ }
159
+ },
160
+ "securityDefinitions": {
161
+ "oauth2": {
162
+ "type": "oauth2",
163
+ "flow": "accessCode",
164
+ "authorizationUrl": "",
165
+ "tokenUrl": "",
166
+ "scopes": {}
167
+ }
168
+ },
169
+ "tags": []
170
+ }
@@ -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
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "",
5
+ "version": "1.0.0",
6
+ "description": ""
7
+ },
8
+ "servers": [
9
+ {
10
+ "url": "http://127.0.0.1/api/v1"
11
+ }
12
+ ],
13
+ "paths": {
14
+ "/extensions": {
15
+ "get": {
16
+ "responses": {
17
+ "200": {
18
+ "description": "OK",
19
+ "headers": {},
20
+ "content": {
21
+ "application/json": {
22
+ "schema": {
23
+ "title": "",
24
+ "type": "object",
25
+ "properties": {
26
+ "id": {
27
+ "type": "string"
28
+ }
29
+ }
30
+ },
31
+ "example": {
32
+ "id": ""
33
+ }
34
+ }
35
+ }
36
+ }
37
+ },
38
+ "summary": "Get extensions",
39
+ "operationId": "Get extensions",
40
+ "description": "",
41
+ "tags": [
42
+ "Extensions"
43
+ ],
44
+ "parameters": []
45
+ }
46
+ }
47
+ },
48
+ "components": {
49
+ "schemas": {
50
+ "Extension": {
51
+ "$ref": "#/components/schemas/Foo type"
52
+ },
53
+ "Foo type": {
54
+ "type": "object",
55
+ "properties": {
56
+ "id": {
57
+ "type": "string",
58
+ "description": "the id"
59
+ }
60
+ }
61
+ }
62
+ }
63
+ },
64
+ "tags": [
65
+ {
66
+ "name": "Extensions"
67
+ }
68
+ ]
69
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "",
5
+ "version": "1.0.0",
6
+ "description": ""
7
+ },
8
+ "servers": [
9
+ {
10
+ "url": "http://127.0.0.1/api/v1"
11
+ }
12
+ ],
13
+ "paths": {
14
+ "/extensions": {
15
+ "get": {
16
+ "responses": {
17
+ "200": {
18
+ "description": "OK",
19
+ "headers": {},
20
+ "content": {
21
+ "application/json": {
22
+ "schema": {
23
+ "$ref": "#/components/schemas/Extension"
24
+ },
25
+ "example": {
26
+ "id": ""
27
+ }
28
+ }
29
+ }
30
+ }
31
+ },
32
+ "summary": "Get extensions",
33
+ "operationId": "Get extensions",
34
+ "description": "",
35
+ "tags": [
36
+ "Extensions"
37
+ ],
38
+ "parameters": []
39
+ }
40
+ }
41
+ },
42
+ "components": {
43
+ "schemas": {
44
+ "Extension": {
45
+ "$ref": "#/components/schemas/Foo type"
46
+ },
47
+ "Foo type": {
48
+ "type": "object",
49
+ "properties": {
50
+ "id": {
51
+ "type": "string",
52
+ "description": "the id"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ },
58
+ "tags": [
59
+ {
60
+ "name": "Extensions"
61
+ }
62
+ ]
63
+ }
@@ -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
  },
@@ -173,6 +179,9 @@
173
179
  ],
174
180
  "produces": [
175
181
  "application/json"
182
+ ],
183
+ "consumes": [
184
+ "application/json"
176
185
  ]
177
186
  }
178
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
  },
@@ -168,6 +174,9 @@
168
174
  ],
169
175
  "produces": [
170
176
  "application/json"
177
+ ],
178
+ "consumes": [
179
+ "application/json"
171
180
  ]
172
181
  }
173
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
  },