apib2swagger 1.12.0 → 1.14.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 (124) hide show
  1. package/.github/workflows/codeql-analysis.yml +71 -0
  2. package/.github/workflows/docker-publish.yml +1 -1
  3. package/.github/workflows/nodejs.yml +1 -1
  4. package/.travis.yml +2 -1
  5. package/Dockerfile +1 -1
  6. package/LICENSE +0 -0
  7. package/README.md +30 -9
  8. package/bin/apib2swagger.js +44 -18
  9. package/index.js +82 -366
  10. package/package.json +7 -4
  11. package/src/escape_json_pointer.js +0 -0
  12. package/src/mson_to_json_schema.js +12 -10
  13. package/src/parameters.js +111 -0
  14. package/src/requests.js +357 -0
  15. package/src/responses.js +186 -0
  16. package/src/util.js +125 -0
  17. package/test/input/Attributes.md +0 -0
  18. package/test/input/Issue-#15.md +0 -0
  19. package/test/input/Issue-#22.md +0 -0
  20. package/test/input/Issue-#23.md +0 -0
  21. package/test/input/Issue-#26.md +0 -0
  22. package/test/input/Issue-#29.md +0 -0
  23. package/test/input/Issue-#33.md +0 -0
  24. package/test/input/Issue-#35.md +0 -0
  25. package/test/input/Issue-#36.md +0 -0
  26. package/test/input/Issue-#38.md +0 -0
  27. package/test/input/Issue-#49.md +0 -0
  28. package/test/input/Issue-#57.md +14 -0
  29. package/test/input/OpenAPI3_Issue-#58.md +31 -0
  30. package/test/input/OpenAPI3_attributes.md +36 -0
  31. package/test/input/OpenAPI3_headers.md +74 -0
  32. package/test/input/OpenAPI3_includes.md +22 -0
  33. package/test/input/OpenAPI3_requests.md +162 -0
  34. package/test/input/OpenAPI3_responses.md +177 -0
  35. package/test/input/Schema.md +0 -0
  36. package/test/input/apiblueprint_uber.md +0 -0
  37. package/test/input/apiblueprint_valid_simple.md +0 -0
  38. package/test/input/includes/resource-request-body-2.json +3 -0
  39. package/test/input/includes/resource-request-body.json +3 -0
  40. package/test/input/includes/resource-request-schema.json +9 -0
  41. package/test/input/includes/resource-response-body-2.json +3 -0
  42. package/test/input/includes/resource-response-body.json +3 -0
  43. package/test/input/includes/resource-response-schema.json +9 -0
  44. package/test/input/schema_without_body.md +17 -0
  45. package/test/meta_schema.json +0 -0
  46. package/test/openAPI_30_schema.json +1662 -0
  47. package/test/output/01. Simplest API.json +0 -0
  48. package/test/output/01. Simplest API.ref.json +0 -0
  49. package/test/output/02. Resource and Actions.json +0 -0
  50. package/test/output/02. Resource and Actions.ref.json +0 -0
  51. package/test/output/03. Named Resource and Actions.json +0 -0
  52. package/test/output/03. Named Resource and Actions.ref.json +0 -0
  53. package/test/output/04. Grouping Resources.json +0 -0
  54. package/test/output/04. Grouping Resources.ref.json +0 -0
  55. package/test/output/05. Responses.json +0 -0
  56. package/test/output/05. Responses.ref.json +0 -0
  57. package/test/output/06. Requests.json +0 -0
  58. package/test/output/06. Requests.ref.json +0 -0
  59. package/test/output/07. Parameters.json +0 -0
  60. package/test/output/07. Parameters.ref.json +0 -0
  61. package/test/output/08. Attributes.json +0 -0
  62. package/test/output/08. Attributes.ref.json +0 -0
  63. package/test/output/09. Advanced Attributes.json +0 -0
  64. package/test/output/09. Advanced Attributes.ref.json +0 -0
  65. package/test/output/10. Data Structures.json +0 -0
  66. package/test/output/10. Data Structures.ref.json +0 -0
  67. package/test/output/11. Resource Model.json +0 -0
  68. package/test/output/11. Resource Model.ref.json +0 -0
  69. package/test/output/12. Advanced Action.json +0 -0
  70. package/test/output/12. Advanced Action.ref.json +0 -0
  71. package/test/output/13. Named Endpoints.json +0 -0
  72. package/test/output/13. Named Endpoints.ref.json +0 -0
  73. package/test/output/Attributes.json +0 -0
  74. package/test/output/Attributes.ref.json +0 -0
  75. package/test/output/Gist Fox API + Auth.json +0 -0
  76. package/test/output/Gist Fox API + Auth.ref.json +0 -0
  77. package/test/output/Issue-#15.json +0 -0
  78. package/test/output/Issue-#15.ref.json +0 -0
  79. package/test/output/Issue-#22.json +0 -0
  80. package/test/output/Issue-#22.ref.json +0 -0
  81. package/test/output/Issue-#23.json +0 -0
  82. package/test/output/Issue-#23.ref.json +0 -0
  83. package/test/output/Issue-#26.json +0 -0
  84. package/test/output/Issue-#26.ref.json +0 -0
  85. package/test/output/Issue-#29.json +0 -0
  86. package/test/output/Issue-#29.ref.json +0 -0
  87. package/test/output/Issue-#33.json +0 -0
  88. package/test/output/Issue-#33.ref.json +0 -0
  89. package/test/output/Issue-#35.json +0 -0
  90. package/test/output/Issue-#35.ref.json +0 -0
  91. package/test/output/Issue-#36.json +0 -0
  92. package/test/output/Issue-#36.ref.json +0 -0
  93. package/test/output/Issue-#38.bearer.json +0 -0
  94. package/test/output/Issue-#38.json +0 -0
  95. package/test/output/Issue-#38.ref.json +0 -0
  96. package/test/output/Issue-#49.json +0 -0
  97. package/test/output/Issue-#49.ref.json +0 -0
  98. package/test/output/Issue-#57.json +44 -0
  99. package/test/output/Issue-#57.ref.json +44 -0
  100. package/test/output/OpenAPI3_Issue-#58.json +202 -0
  101. package/test/output/OpenAPI3_Issue-#58.ref.json +163 -0
  102. package/test/output/OpenAPI3_attributes.json +199 -0
  103. package/test/output/OpenAPI3_attributes.ref.json +173 -0
  104. package/test/output/OpenAPI3_headers.json +169 -0
  105. package/test/output/OpenAPI3_headers.ref.json +169 -0
  106. package/test/output/OpenAPI3_includes.json +66 -0
  107. package/test/output/OpenAPI3_includes.ref.json +66 -0
  108. package/test/output/OpenAPI3_requests.json +326 -0
  109. package/test/output/OpenAPI3_requests.ref.json +321 -0
  110. package/test/output/OpenAPI3_responses.json +255 -0
  111. package/test/output/OpenAPI3_responses.ref.json +245 -0
  112. package/test/output/Schema.json +0 -0
  113. package/test/output/Schema.ref.json +0 -0
  114. package/test/output/apiblueprint_uber.json +0 -0
  115. package/test/output/apiblueprint_uber.ref.json +0 -0
  116. package/test/output/apiblueprint_valid_simple.json +0 -0
  117. package/test/output/apiblueprint_valid_simple.ref.json +0 -0
  118. package/test/output/schema_without_body.json +52 -0
  119. package/test/output/schema_without_body.ref.json +52 -0
  120. package/test/swagger_20_schema.json +0 -0
  121. package/test/test.js +26 -9
  122. package/test/util.test.js +151 -0
  123. package/.npmignore +0 -35
  124. package/package-lock.json +0 -2021
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,44 @@
1
+ {
2
+ "swagger": "2.0",
3
+ "info": {
4
+ "title": "",
5
+ "version": "",
6
+ "description": ""
7
+ },
8
+ "paths": {
9
+ "/domains": {
10
+ "delete": {
11
+ "responses": {
12
+ "204": {
13
+ "description": "No Content",
14
+ "headers": {},
15
+ "examples": {}
16
+ }
17
+ },
18
+ "summary": "",
19
+ "operationId": "",
20
+ "description": "",
21
+ "tags": [],
22
+ "parameters": [
23
+ {
24
+ "name": "body",
25
+ "in": "body",
26
+ "schema": {
27
+ "type": "array",
28
+ "items": {
29
+ "type": "string"
30
+ },
31
+ "example": [
32
+ "example1.com",
33
+ "example2.com"
34
+ ]
35
+ }
36
+ }
37
+ ]
38
+ }
39
+ }
40
+ },
41
+ "definitions": {},
42
+ "securityDefinitions": {},
43
+ "tags": []
44
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "swagger": "2.0",
3
+ "info": {
4
+ "title": "",
5
+ "version": "",
6
+ "description": ""
7
+ },
8
+ "paths": {
9
+ "/domains": {
10
+ "delete": {
11
+ "responses": {
12
+ "204": {
13
+ "description": "No Content",
14
+ "headers": {},
15
+ "examples": {}
16
+ }
17
+ },
18
+ "summary": "",
19
+ "operationId": "",
20
+ "description": "",
21
+ "tags": [],
22
+ "parameters": [
23
+ {
24
+ "name": "body",
25
+ "in": "body",
26
+ "schema": {
27
+ "type": "array",
28
+ "items": {
29
+ "type": "string"
30
+ },
31
+ "example": [
32
+ "example1.com",
33
+ "example2.com"
34
+ ]
35
+ }
36
+ }
37
+ ]
38
+ }
39
+ }
40
+ },
41
+ "definitions": {},
42
+ "securityDefinitions": {},
43
+ "tags": []
44
+ }
@@ -0,0 +1,202 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "",
5
+ "version": "1.0.0",
6
+ "description": ""
7
+ },
8
+ "paths": {
9
+ "/user": {
10
+ "get": {
11
+ "responses": {
12
+ "200": {
13
+ "description": "OK",
14
+ "headers": {},
15
+ "content": {
16
+ "application/json": {
17
+ "schema": {
18
+ "type": "object",
19
+ "properties": {
20
+ "id": {
21
+ "type": "string"
22
+ },
23
+ "name": {
24
+ "type": "string",
25
+ "nullable": true
26
+ }
27
+ },
28
+ "required": [
29
+ "id",
30
+ "name"
31
+ ]
32
+ },
33
+ "example": {
34
+ "id": "",
35
+ "name": null
36
+ }
37
+ }
38
+ }
39
+ },
40
+ "500": {
41
+ "description": "Internal Server Error",
42
+ "headers": {},
43
+ "content": {}
44
+ }
45
+ },
46
+ "summary": "Get one user",
47
+ "operationId": "Get one user",
48
+ "description": "",
49
+ "tags": [
50
+ "Users"
51
+ ],
52
+ "parameters": []
53
+ }
54
+ },
55
+ "/users": {
56
+ "post": {
57
+ "responses": {
58
+ "201": {
59
+ "description": "Created",
60
+ "headers": {},
61
+ "content": {
62
+ "application/json": {
63
+ "schema": {
64
+ "type": "object",
65
+ "properties": {
66
+ "id": {
67
+ "type": "string"
68
+ },
69
+ "name": {
70
+ "type": "string",
71
+ "nullable": true
72
+ }
73
+ },
74
+ "required": [
75
+ "id",
76
+ "name"
77
+ ]
78
+ },
79
+ "example": {
80
+ "id": "",
81
+ "name": null
82
+ }
83
+ }
84
+ }
85
+ },
86
+ "500": {
87
+ "description": "Internal Server Error",
88
+ "headers": {},
89
+ "content": {}
90
+ }
91
+ },
92
+ "summary": "Post a user",
93
+ "operationId": "Post a user",
94
+ "description": "",
95
+ "tags": [
96
+ "Users"
97
+ ],
98
+ "parameters": [],
99
+ "requestBody": {
100
+ "content": {
101
+ "application/json": {
102
+ "example": {
103
+ "id": "",
104
+ "name": null
105
+ },
106
+ "schema": {
107
+ "type": "object",
108
+ "properties": {
109
+ "id": {
110
+ "type": "string"
111
+ },
112
+ "name": {
113
+ "type": "string",
114
+ "nullable": true
115
+ }
116
+ },
117
+ "required": [
118
+ "id",
119
+ "name"
120
+ ]
121
+ }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "get": {
127
+ "responses": {
128
+ "200": {
129
+ "description": "OK",
130
+ "headers": {},
131
+ "content": {
132
+ "application/json": {
133
+ "schema": {
134
+ "type": "array",
135
+ "items": {}
136
+ },
137
+ "example": [
138
+ {
139
+ "id": "",
140
+ "name": null
141
+ }
142
+ ]
143
+ }
144
+ }
145
+ },
146
+ "500": {
147
+ "description": "Internal Server Error",
148
+ "headers": {},
149
+ "content": {}
150
+ }
151
+ },
152
+ "summary": "Get a collection of users",
153
+ "operationId": "Get a collection of users",
154
+ "description": "",
155
+ "tags": [
156
+ "Users"
157
+ ],
158
+ "parameters": []
159
+ }
160
+ }
161
+ },
162
+ "components": {
163
+ "schemas": {
164
+ "User": {
165
+ "type": "object",
166
+ "required": [
167
+ "id",
168
+ "name"
169
+ ],
170
+ "properties": {
171
+ "id": {
172
+ "type": "string"
173
+ },
174
+ "name": {
175
+ "type": "string",
176
+ "nullable": true
177
+ }
178
+ }
179
+ },
180
+ "Users": {
181
+ "type": "object",
182
+ "required": [
183
+ "users"
184
+ ],
185
+ "properties": {
186
+ "users": {
187
+ "type": "array",
188
+ "items": {
189
+ "$ref": "#/components/schemas/User"
190
+ },
191
+ "nullable": true
192
+ }
193
+ }
194
+ }
195
+ }
196
+ },
197
+ "tags": [
198
+ {
199
+ "name": "Users"
200
+ }
201
+ ]
202
+ }
@@ -0,0 +1,163 @@
1
+ {
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "",
5
+ "version": "1.0.0",
6
+ "description": ""
7
+ },
8
+ "paths": {
9
+ "/user": {
10
+ "get": {
11
+ "responses": {
12
+ "200": {
13
+ "description": "OK",
14
+ "headers": {},
15
+ "content": {
16
+ "application/json": {
17
+ "schema": {
18
+ "$ref": "#/components/schemas/User"
19
+ },
20
+ "example": {
21
+ "id": "",
22
+ "name": null
23
+ }
24
+ }
25
+ }
26
+ },
27
+ "500": {
28
+ "description": "Internal Server Error",
29
+ "headers": {},
30
+ "content": {}
31
+ }
32
+ },
33
+ "summary": "Get one user",
34
+ "operationId": "Get one user",
35
+ "description": "",
36
+ "tags": [
37
+ "Users"
38
+ ],
39
+ "parameters": []
40
+ }
41
+ },
42
+ "/users": {
43
+ "post": {
44
+ "responses": {
45
+ "201": {
46
+ "description": "Created",
47
+ "headers": {},
48
+ "content": {
49
+ "application/json": {
50
+ "schema": {
51
+ "$ref": "#/components/schemas/User"
52
+ },
53
+ "example": {
54
+ "id": "",
55
+ "name": null
56
+ }
57
+ }
58
+ }
59
+ },
60
+ "500": {
61
+ "description": "Internal Server Error",
62
+ "headers": {},
63
+ "content": {}
64
+ }
65
+ },
66
+ "summary": "Post a user",
67
+ "operationId": "Post a user",
68
+ "description": "",
69
+ "tags": [
70
+ "Users"
71
+ ],
72
+ "parameters": [],
73
+ "requestBody": {
74
+ "content": {
75
+ "application/json": {
76
+ "example": {
77
+ "id": "",
78
+ "name": null
79
+ },
80
+ "schema": {
81
+ "$ref": "#/components/schemas/User"
82
+ }
83
+ }
84
+ }
85
+ }
86
+ },
87
+ "get": {
88
+ "responses": {
89
+ "200": {
90
+ "description": "OK",
91
+ "headers": {},
92
+ "content": {
93
+ "application/json": {
94
+ "schema": {
95
+ "type": "array",
96
+ "items": {}
97
+ },
98
+ "example": [
99
+ {
100
+ "id": "",
101
+ "name": null
102
+ }
103
+ ]
104
+ }
105
+ }
106
+ },
107
+ "500": {
108
+ "description": "Internal Server Error",
109
+ "headers": {},
110
+ "content": {}
111
+ }
112
+ },
113
+ "summary": "Get a collection of users",
114
+ "operationId": "Get a collection of users",
115
+ "description": "",
116
+ "tags": [
117
+ "Users"
118
+ ],
119
+ "parameters": []
120
+ }
121
+ }
122
+ },
123
+ "components": {
124
+ "schemas": {
125
+ "User": {
126
+ "type": "object",
127
+ "required": [
128
+ "id",
129
+ "name"
130
+ ],
131
+ "properties": {
132
+ "id": {
133
+ "type": "string"
134
+ },
135
+ "name": {
136
+ "type": "string",
137
+ "nullable": true
138
+ }
139
+ }
140
+ },
141
+ "Users": {
142
+ "type": "object",
143
+ "required": [
144
+ "users"
145
+ ],
146
+ "properties": {
147
+ "users": {
148
+ "type": "array",
149
+ "items": {
150
+ "$ref": "#/components/schemas/User"
151
+ },
152
+ "nullable": true
153
+ }
154
+ }
155
+ }
156
+ }
157
+ },
158
+ "tags": [
159
+ {
160
+ "name": "Users"
161
+ }
162
+ ]
163
+ }