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
@@ -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
  },
@@ -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
  }
@@ -27,6 +27,15 @@
27
27
  "description": "information about bob"
28
28
  }
29
29
  }
30
+ },
31
+ "Filter": {
32
+ "type": "object",
33
+ "properties": {
34
+ "status": {
35
+ "type": "array",
36
+ "items": {}
37
+ }
38
+ }
30
39
  }
31
40
  },
32
41
  "securityDefinitions": {},
@@ -27,6 +27,15 @@
27
27
  "description": "information about bob"
28
28
  }
29
29
  }
30
+ },
31
+ "Filter": {
32
+ "type": "object",
33
+ "properties": {
34
+ "status": {
35
+ "type": "array",
36
+ "items": {}
37
+ }
38
+ }
30
39
  }
31
40
  },
32
41
  "securityDefinitions": {},
@@ -1,173 +1,174 @@
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
- "/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"
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
- "summary": "Some resource",
55
- "operationId": "Some resource",
56
- "description": "",
57
- "tags": [],
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
- "summary": "Some resource",
100
- "operationId": "Some resource",
101
- "description": "",
102
- "tags": [],
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
- "/messages": {
119
- "get": {
120
- "responses": {
121
- "200": {
122
- "description": "OK",
123
- "headers": {},
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
- "components": {
150
- "schemas": {
151
- "Message": {
152
- "type": "object",
153
- "properties": {
154
- "message": {
155
- "type": "string"
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
- "OtherMessage": {
160
- "type": "object",
161
- "properties": {
85
+ }
86
+ },
87
+ "example": [
88
+ {
89
+ "path": "/files",
162
90
  "otherMessage": {
163
- "type": "string"
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
- "tags": []
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
  }