serverless-openapi-documenter 0.0.119 → 0.0.121
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.
- package/README.md +2 -1
- package/package.json +5 -1
- package/src/bruno.js +32 -0
- package/src/collection.js +29 -0
- package/src/openAPIGenerator.js +32 -37
- package/src/postman.js +53 -0
- package/test/.mocharc.js +0 -9
- package/test/helpers/redocly.json +0 -4
- package/test/helpers/ref-parser.js +0 -5
- package/test/helpers/serverless.js +0 -19
- package/test/json/complex.json +0 -91
- package/test/json/newOWASP.json +0 -53
- package/test/json/valid-openAPI.json +0 -274
- package/test/models/BasicDocumentation.json +0 -48
- package/test/models/BasicValidFunction.json +0 -44
- package/test/models/ErrorResponse.json +0 -118
- package/test/models/PutDocumentResponse.json +0 -5
- package/test/models/models/models-alt.json +0 -17
- package/test/models/models/models.json +0 -20
- package/test/models/models/modelsList-alt.json +0 -17
- package/test/models/models/modelsList.json +0 -20
- package/test/unit/definitionGenerator.spec.js +0 -980
- package/test/unit/logger.spec.js +0 -160
- package/test/unit/openAPIGenerator.spec.js +0 -275
- package/test/unit/owasp.spec.js +0 -120
- package/test/unit/schemaHandler.spec.js +0 -923
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"openapi": "3.0.3",
|
|
3
|
-
"info": {
|
|
4
|
-
"title": "serverless-openapi-doc-demo",
|
|
5
|
-
"description": "This is a description of what this does",
|
|
6
|
-
"version": "1.0.0"
|
|
7
|
-
},
|
|
8
|
-
"components": {
|
|
9
|
-
"schemas": {
|
|
10
|
-
"username": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"pattern": "^[-a-z0-9_]+$"
|
|
13
|
-
},
|
|
14
|
-
"membershipType": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"enum": [
|
|
17
|
-
"premium",
|
|
18
|
-
"standard"
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
"SessionId": {
|
|
22
|
-
"type": "string"
|
|
23
|
-
},
|
|
24
|
-
"PutDocumentRequest": {
|
|
25
|
-
"properties": {
|
|
26
|
-
"SomeObject": {
|
|
27
|
-
"type": "object",
|
|
28
|
-
"properties": {
|
|
29
|
-
"SomeAttribute": {
|
|
30
|
-
"type": "string"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"PutDocumentResponse": {
|
|
37
|
-
"title": "Empty Schema",
|
|
38
|
-
"type": "object"
|
|
39
|
-
},
|
|
40
|
-
"error": {
|
|
41
|
-
"type": "object",
|
|
42
|
-
"properties": {
|
|
43
|
-
"id": {
|
|
44
|
-
"description": "A unique identifier for this particular occurrence of the problem.",
|
|
45
|
-
"type": "string"
|
|
46
|
-
},
|
|
47
|
-
"links": {
|
|
48
|
-
"$ref": "#/components/schemas/links"
|
|
49
|
-
},
|
|
50
|
-
"status": {
|
|
51
|
-
"description": "The HTTP status code applicable to this problem, expressed as a string value.",
|
|
52
|
-
"type": "string"
|
|
53
|
-
},
|
|
54
|
-
"code": {
|
|
55
|
-
"description": "An application-specific error code, expressed as a string value.",
|
|
56
|
-
"type": "string"
|
|
57
|
-
},
|
|
58
|
-
"title": {
|
|
59
|
-
"description": "A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization.",
|
|
60
|
-
"type": "string"
|
|
61
|
-
},
|
|
62
|
-
"detail": {
|
|
63
|
-
"description": "A human-readable explanation specific to this occurrence of the problem.",
|
|
64
|
-
"type": "string"
|
|
65
|
-
},
|
|
66
|
-
"source": {
|
|
67
|
-
"type": "object",
|
|
68
|
-
"properties": {
|
|
69
|
-
"pointer": {
|
|
70
|
-
"description": "A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute].",
|
|
71
|
-
"type": "string"
|
|
72
|
-
},
|
|
73
|
-
"parameter": {
|
|
74
|
-
"description": "A string indicating which query parameter caused the error.",
|
|
75
|
-
"type": "string"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"meta": {
|
|
80
|
-
"$ref": "#/components/schemas/meta"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"additionalProperties": false
|
|
84
|
-
},
|
|
85
|
-
"meta": {
|
|
86
|
-
"description": "Non-standard meta-information that can not be represented as an attribute or relationship.",
|
|
87
|
-
"type": "object",
|
|
88
|
-
"additionalProperties": true
|
|
89
|
-
},
|
|
90
|
-
"links": {
|
|
91
|
-
"description": "A resource object **MAY** contain references to other resource objects (\"relationships\"). Relationships may be to-one or to-many. Relationships can be specified by including a member in a resource's links object.",
|
|
92
|
-
"type": "object",
|
|
93
|
-
"properties": {
|
|
94
|
-
"self": {
|
|
95
|
-
"description": "A `self` member, whose value is a URL for the relationship itself (a \"relationship URL\"). This URL allows the client to directly manipulate the relationship. For example, it would allow a client to remove an `author` from an `article` without deleting the people resource itself.",
|
|
96
|
-
"type": "string",
|
|
97
|
-
"format": "uri"
|
|
98
|
-
},
|
|
99
|
-
"related": {
|
|
100
|
-
"$ref": "#/components/schemas/link"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
"additionalProperties": true
|
|
104
|
-
},
|
|
105
|
-
"link": {
|
|
106
|
-
"description": "A link **MUST** be represented as either: a string containing the link's URL or a link object.",
|
|
107
|
-
"oneOf": [
|
|
108
|
-
{
|
|
109
|
-
"description": "A string containing the link's URL.",
|
|
110
|
-
"type": "string",
|
|
111
|
-
"format": "uri"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"type": "object",
|
|
115
|
-
"required": [
|
|
116
|
-
"href"
|
|
117
|
-
],
|
|
118
|
-
"properties": {
|
|
119
|
-
"href": {
|
|
120
|
-
"description": "A string containing the link's URL.",
|
|
121
|
-
"type": "string",
|
|
122
|
-
"format": "uri"
|
|
123
|
-
},
|
|
124
|
-
"meta": {
|
|
125
|
-
"$ref": "#/components/schemas/meta"
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
},
|
|
131
|
-
"ErrorResponse": {
|
|
132
|
-
"title": "JSON API Schema",
|
|
133
|
-
"description": "This is a schema for responses in the JSON API format. For more, see http://jsonapi.org",
|
|
134
|
-
"type": "object",
|
|
135
|
-
"required": [
|
|
136
|
-
"errors"
|
|
137
|
-
],
|
|
138
|
-
"properties": {
|
|
139
|
-
"errors": {
|
|
140
|
-
"type": "array",
|
|
141
|
-
"items": {
|
|
142
|
-
"$ref": "#/components/schemas/error"
|
|
143
|
-
},
|
|
144
|
-
"uniqueItems": true
|
|
145
|
-
},
|
|
146
|
-
"meta": {
|
|
147
|
-
"$ref": "#/components/schemas/meta"
|
|
148
|
-
},
|
|
149
|
-
"links": {
|
|
150
|
-
"$ref": "#/components/schemas/links"
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
"additionalProperties": false
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
"paths": {
|
|
158
|
-
"/create/{username}": {
|
|
159
|
-
"post": {
|
|
160
|
-
"summary": "Create User",
|
|
161
|
-
"description": "Creates a user and then sends a generated password email",
|
|
162
|
-
"operationId": "serverless-openapi-doc-demo-dev-createUser",
|
|
163
|
-
"parameters": [
|
|
164
|
-
{
|
|
165
|
-
"name": "username",
|
|
166
|
-
"in": "path",
|
|
167
|
-
"description": "The username for a user to create",
|
|
168
|
-
"required": true,
|
|
169
|
-
"schema": {
|
|
170
|
-
"$ref": "#/components/schemas/username"
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
"name": "membershipType",
|
|
175
|
-
"in": "query",
|
|
176
|
-
"description": "The user's Membership Type",
|
|
177
|
-
"required": false,
|
|
178
|
-
"schema": {
|
|
179
|
-
"$ref": "#/components/schemas/membershipType"
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"name": "SessionId",
|
|
184
|
-
"in": "cookie",
|
|
185
|
-
"description": "A Session ID variable",
|
|
186
|
-
"required": false,
|
|
187
|
-
"schema": {
|
|
188
|
-
"$ref": "#/components/schemas/SessionId"
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
],
|
|
192
|
-
"tags": [
|
|
193
|
-
"jesus"
|
|
194
|
-
],
|
|
195
|
-
"externalDocs": {
|
|
196
|
-
"url": "https://bing.com",
|
|
197
|
-
"description": "A link to bing"
|
|
198
|
-
},
|
|
199
|
-
"requestBody": {
|
|
200
|
-
"description": "A user information object",
|
|
201
|
-
"required": false,
|
|
202
|
-
"content": {
|
|
203
|
-
"application/json": {
|
|
204
|
-
"schema": {
|
|
205
|
-
"$ref": "#/components/schemas/PutDocumentRequest"
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
"responses": {
|
|
211
|
-
"201": {
|
|
212
|
-
"description": "A user object along with generated API Keys",
|
|
213
|
-
"content": {
|
|
214
|
-
"application/json": {
|
|
215
|
-
"schema": {
|
|
216
|
-
"$ref": "#/components/schemas/PutDocumentResponse"
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
"500": {
|
|
222
|
-
"description": "An error message when creating a new user",
|
|
223
|
-
"content": {
|
|
224
|
-
"application/json": {
|
|
225
|
-
"schema": {
|
|
226
|
-
"$ref": "#/components/schemas/ErrorResponse"
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
"summary": "a function",
|
|
234
|
-
"description": "blah blah"
|
|
235
|
-
},
|
|
236
|
-
"/patch/": {
|
|
237
|
-
"patch": {
|
|
238
|
-
"summary": "Patch a User",
|
|
239
|
-
"description": "Patch details about the user",
|
|
240
|
-
"operationId": "serverless-openapi-doc-demo-dev-patchUser",
|
|
241
|
-
"parameters": [],
|
|
242
|
-
"tags": [
|
|
243
|
-
"patching"
|
|
244
|
-
],
|
|
245
|
-
"responses": {
|
|
246
|
-
"200": {
|
|
247
|
-
"description": "A user object along with generated API Keys",
|
|
248
|
-
"content": {
|
|
249
|
-
"application/json": {
|
|
250
|
-
"schema": {
|
|
251
|
-
"$ref": "#/components/schemas/PutDocumentResponse"
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
"tags": [
|
|
261
|
-
{
|
|
262
|
-
"name": "jesus",
|
|
263
|
-
"description": "jesus was a man",
|
|
264
|
-
"externalDocs": {
|
|
265
|
-
"url": "https://whitehouse.gov",
|
|
266
|
-
"description": "a link to the whitehouse"
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
],
|
|
270
|
-
"externalDocs": {
|
|
271
|
-
"url": "https://google.com",
|
|
272
|
-
"description": "A link to google"
|
|
273
|
-
}
|
|
274
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"custom": {
|
|
3
|
-
"documentation": {
|
|
4
|
-
"title": "test-service",
|
|
5
|
-
"models": [
|
|
6
|
-
{
|
|
7
|
-
"name": "SuccessResponse",
|
|
8
|
-
"description": "Success response",
|
|
9
|
-
"content": {
|
|
10
|
-
"application/json": {
|
|
11
|
-
"schema": {
|
|
12
|
-
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
13
|
-
"type": "object",
|
|
14
|
-
"properties": {
|
|
15
|
-
"SomeObject": {
|
|
16
|
-
"type": "object",
|
|
17
|
-
"properties": {
|
|
18
|
-
"SomeAttribute": {
|
|
19
|
-
"type": "string"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"name": "ErrorResponse",
|
|
30
|
-
"description": "Error response",
|
|
31
|
-
"content": {
|
|
32
|
-
"application/json": {
|
|
33
|
-
"schema": {
|
|
34
|
-
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
35
|
-
"type": "object",
|
|
36
|
-
"properties": {
|
|
37
|
-
"error": {
|
|
38
|
-
"type": "string"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"createUser": {
|
|
3
|
-
"name": "createUser",
|
|
4
|
-
"handler": "handler.create",
|
|
5
|
-
"events": [
|
|
6
|
-
{
|
|
7
|
-
"http": {
|
|
8
|
-
"path": "find/{name}",
|
|
9
|
-
"method": "get",
|
|
10
|
-
"documentation": {
|
|
11
|
-
"pathParams": [
|
|
12
|
-
{
|
|
13
|
-
"name": "name",
|
|
14
|
-
"schema": {
|
|
15
|
-
"type": "string"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"methodResponses": [
|
|
20
|
-
{
|
|
21
|
-
"statusCode": 200,
|
|
22
|
-
"responseBody": {
|
|
23
|
-
"description": "A user object along with generated API Keys"
|
|
24
|
-
},
|
|
25
|
-
"responseModels": {
|
|
26
|
-
"application/json": "SuccessResponse"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"statusCode": 400,
|
|
31
|
-
"responseBody": {
|
|
32
|
-
"description": "An Error"
|
|
33
|
-
},
|
|
34
|
-
"responseModels": {
|
|
35
|
-
"application/json": "ErrorResponse"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
3
|
-
"title": "JSON API Schema",
|
|
4
|
-
"description": "This is a schema for responses in the JSON API format. For more, see http://jsonapi.org",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"required": [
|
|
7
|
-
"errors"
|
|
8
|
-
],
|
|
9
|
-
"properties": {
|
|
10
|
-
"errors": {
|
|
11
|
-
"type": "array",
|
|
12
|
-
"items": {
|
|
13
|
-
"$ref": "#/definitions/error"
|
|
14
|
-
},
|
|
15
|
-
"uniqueItems": true
|
|
16
|
-
},
|
|
17
|
-
"meta": {
|
|
18
|
-
"$ref": "#/definitions/meta"
|
|
19
|
-
},
|
|
20
|
-
"links": {
|
|
21
|
-
"$ref": "#/definitions/links"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"additionalProperties": false,
|
|
25
|
-
"definitions": {
|
|
26
|
-
"meta": {
|
|
27
|
-
"description": "Non-standard meta-information that can not be represented as an attribute or relationship.",
|
|
28
|
-
"type": "object",
|
|
29
|
-
"additionalProperties": true
|
|
30
|
-
},
|
|
31
|
-
"links": {
|
|
32
|
-
"description": "A resource object **MAY** contain references to other resource objects (\"relationships\"). Relationships may be to-one or to-many. Relationships can be specified by including a member in a resource's links object.",
|
|
33
|
-
"type": "object",
|
|
34
|
-
"properties": {
|
|
35
|
-
"self": {
|
|
36
|
-
"description": "A `self` member, whose value is a URL for the relationship itself (a \"relationship URL\"). This URL allows the client to directly manipulate the relationship. For example, it would allow a client to remove an `author` from an `article` without deleting the people resource itself.",
|
|
37
|
-
"type": "string",
|
|
38
|
-
"format": "uri"
|
|
39
|
-
},
|
|
40
|
-
"related": {
|
|
41
|
-
"$ref": "#/definitions/link"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"additionalProperties": true
|
|
45
|
-
},
|
|
46
|
-
"link": {
|
|
47
|
-
"description": "A link **MUST** be represented as either: a string containing the link's URL or a link object.",
|
|
48
|
-
"oneOf": [
|
|
49
|
-
{
|
|
50
|
-
"description": "A string containing the link's URL.",
|
|
51
|
-
"type": "string",
|
|
52
|
-
"format": "uri"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"type": "object",
|
|
56
|
-
"required": [
|
|
57
|
-
"href"
|
|
58
|
-
],
|
|
59
|
-
"properties": {
|
|
60
|
-
"href": {
|
|
61
|
-
"description": "A string containing the link's URL.",
|
|
62
|
-
"type": "string",
|
|
63
|
-
"format": "uri"
|
|
64
|
-
},
|
|
65
|
-
"meta": {
|
|
66
|
-
"$ref": "#/definitions/meta"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
"error": {
|
|
73
|
-
"type": "object",
|
|
74
|
-
"properties": {
|
|
75
|
-
"id": {
|
|
76
|
-
"description": "A unique identifier for this particular occurrence of the problem.",
|
|
77
|
-
"type": "string"
|
|
78
|
-
},
|
|
79
|
-
"links": {
|
|
80
|
-
"$ref": "#/definitions/links"
|
|
81
|
-
},
|
|
82
|
-
"status": {
|
|
83
|
-
"description": "The HTTP status code applicable to this problem, expressed as a string value.",
|
|
84
|
-
"type": "string"
|
|
85
|
-
},
|
|
86
|
-
"code": {
|
|
87
|
-
"description": "An application-specific error code, expressed as a string value.",
|
|
88
|
-
"type": "string"
|
|
89
|
-
},
|
|
90
|
-
"title": {
|
|
91
|
-
"description": "A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization.",
|
|
92
|
-
"type": "string"
|
|
93
|
-
},
|
|
94
|
-
"detail": {
|
|
95
|
-
"description": "A human-readable explanation specific to this occurrence of the problem.",
|
|
96
|
-
"type": "string"
|
|
97
|
-
},
|
|
98
|
-
"source": {
|
|
99
|
-
"type": "object",
|
|
100
|
-
"properties": {
|
|
101
|
-
"pointer": {
|
|
102
|
-
"description": "A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute].",
|
|
103
|
-
"type": "string"
|
|
104
|
-
},
|
|
105
|
-
"parameter": {
|
|
106
|
-
"description": "A string indicating which query parameter caused the error.",
|
|
107
|
-
"type": "string"
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"meta": {
|
|
112
|
-
"$ref": "#/definitions/meta"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
"additionalProperties": false
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"models": [
|
|
3
|
-
{
|
|
4
|
-
"name": "ErrorResponse",
|
|
5
|
-
"description": "The Error Response",
|
|
6
|
-
"content": {
|
|
7
|
-
"application/json": {
|
|
8
|
-
"schema": {
|
|
9
|
-
"type": "object",
|
|
10
|
-
"properties": {
|
|
11
|
-
"error": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"modelsList": [
|
|
3
|
-
{
|
|
4
|
-
"name": "ErrorResponse",
|
|
5
|
-
"description": "The Error Response",
|
|
6
|
-
"content": {
|
|
7
|
-
"application/json": {
|
|
8
|
-
"schema": {
|
|
9
|
-
"type": "object",
|
|
10
|
-
"properties": {
|
|
11
|
-
"error": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|