oas 16.0.2 → 16.0.3
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## <small>16.0.3 (2021-10-28)</small>
|
|
2
|
+
|
|
3
|
+
* ci: building the dist before running tests and linting ([119e915](https://github.com/readmeio/oas/commit/119e915))
|
|
4
|
+
* ci: run builds AFTER source is present ([1bf143b](https://github.com/readmeio/oas/commit/1bf143b))
|
|
5
|
+
* fix: turning on the downlevelIteration TS option to fix iterator quirks ([5e8d3db](https://github.com/readmeio/oas/commit/5e8d3db))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
1
9
|
## <small>16.0.2 (2021-10-28)</small>
|
|
2
10
|
|
|
3
11
|
* fix: minor typescript cleanup ([f032a30](https://github.com/readmeio/oas/commit/f032a30))
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
56
56
|
}
|
|
57
57
|
return t;
|
|
58
58
|
};
|
|
59
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
60
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
61
|
+
if (!m) return o;
|
|
62
|
+
var i = m.call(o), r, ar = [], e;
|
|
63
|
+
try {
|
|
64
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
65
|
+
}
|
|
66
|
+
catch (error) { e = { error: error }; }
|
|
67
|
+
finally {
|
|
68
|
+
try {
|
|
69
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
70
|
+
}
|
|
71
|
+
finally { if (e) throw e.error; }
|
|
72
|
+
}
|
|
73
|
+
return ar;
|
|
74
|
+
};
|
|
59
75
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
60
76
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
61
77
|
if (ar || !(i in from)) {
|
|
@@ -306,7 +322,7 @@ var Oas = /** @class */ (function () {
|
|
|
306
322
|
// way we'll be able to extract the parameter names and match them up with the matched server that we obtained
|
|
307
323
|
// above.
|
|
308
324
|
var variables = {};
|
|
309
|
-
__spreadArray([], server.url.matchAll(/{([-_a-zA-Z0-9[\]]+)}/g),
|
|
325
|
+
__spreadArray([], __read(server.url.matchAll(/{([-_a-zA-Z0-9[\]]+)}/g)), false).forEach(function (variable, y) {
|
|
310
326
|
variables[variable[1]] = found[y + 1];
|
|
311
327
|
});
|
|
312
328
|
return {
|
|
@@ -437,7 +453,7 @@ var Oas = /** @class */ (function () {
|
|
|
437
453
|
// directly modifying `matchedServer.url` will in turn update `this.servers[idx].url` which we absolutely do not
|
|
438
454
|
// want to happen.
|
|
439
455
|
targetServer = __assign(__assign({}, matchedServer), { url: this.replaceUrl(matchedServer.url, matchedServer.variables || {}) });
|
|
440
|
-
_a = url.split(new RegExp(targetServer.url, 'i')), pathName = _a[1];
|
|
456
|
+
_a = __read(url.split(new RegExp(targetServer.url, 'i')), 2), pathName = _a[1];
|
|
441
457
|
}
|
|
442
458
|
if (pathName === undefined)
|
|
443
459
|
return undefined;
|
|
@@ -571,7 +587,7 @@ var Oas = /** @class */ (function () {
|
|
|
571
587
|
if (setIfMissing === void 0) { setIfMissing = false; }
|
|
572
588
|
var allTags = new Set();
|
|
573
589
|
Object.entries(this.getPaths()).forEach(function (_a) {
|
|
574
|
-
var path =
|
|
590
|
+
var _b = __read(_a, 2), path = _b[0], operations = _b[1];
|
|
575
591
|
Object.values(operations).forEach(function (operation) {
|
|
576
592
|
var tags = operation.getTags();
|
|
577
593
|
if (setIfMissing && !tags.length) {
|
|
@@ -583,7 +599,7 @@ var Oas = /** @class */ (function () {
|
|
|
583
599
|
});
|
|
584
600
|
});
|
|
585
601
|
});
|
|
586
|
-
return __spreadArray([], allTags,
|
|
602
|
+
return __spreadArray([], __read(allTags), false);
|
|
587
603
|
};
|
|
588
604
|
/**
|
|
589
605
|
* Dereference the current OAS definition so it can be parsed free of worries of `$ref` schemas and circular
|
|
@@ -9,6 +9,22 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
12
28
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
29
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
30
|
if (ar || !(i in from)) {
|
|
@@ -136,7 +152,7 @@ function searchForExampleByPointer(pointer, examples) {
|
|
|
136
152
|
pointers.push(point);
|
|
137
153
|
}
|
|
138
154
|
var example;
|
|
139
|
-
var rev = __spreadArray([], examples,
|
|
155
|
+
var rev = __spreadArray([], __read(examples), false).reverse();
|
|
140
156
|
for (var i = 0; i < pointers.length; i += 1) {
|
|
141
157
|
for (var ii = 0; ii < rev.length; ii += 1) {
|
|
142
158
|
var schema = rev[ii];
|
|
@@ -454,7 +470,7 @@ function toJSONSchema(data, opts) {
|
|
|
454
470
|
}
|
|
455
471
|
// Enums should not have duplicated items as those will break AJV validation.
|
|
456
472
|
if ('enum' in schema && Array.isArray(schema["enum"])) {
|
|
457
|
-
schema["enum"] = __spreadArray([], new Set(schema["enum"]),
|
|
473
|
+
schema["enum"] = __spreadArray([], __read(new Set(schema["enum"])), false);
|
|
458
474
|
}
|
|
459
475
|
// Clean up any remaining `items` or `properties` schema fragments lying around if there's also polymorphism present.
|
|
460
476
|
if ('allOf' in schema || 'anyOf' in schema || 'oneOf' in schema) {
|
|
@@ -1,13 +1,38 @@
|
|
|
1
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
+
if (!m) return o;
|
|
4
|
+
var i = m.call(o), r, ar = [], e;
|
|
5
|
+
try {
|
|
6
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
+
}
|
|
8
|
+
catch (error) { e = { error: error }; }
|
|
9
|
+
finally {
|
|
10
|
+
try {
|
|
11
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
+
}
|
|
13
|
+
finally { if (e) throw e.error; }
|
|
14
|
+
}
|
|
15
|
+
return ar;
|
|
16
|
+
};
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
1
26
|
var getResponseExamples = require('./get-response-examples');
|
|
2
27
|
/**
|
|
3
28
|
* @param {object} operation
|
|
4
29
|
*/
|
|
5
30
|
module.exports = function (operation) {
|
|
6
31
|
// spreads the contents of the map for each callback so there's not nested arrays returned
|
|
7
|
-
return [].concat.apply([], Object.keys(operation.callbacks || {}).map(function (identifier) {
|
|
32
|
+
return [].concat.apply([], __spreadArray([], __read(Object.keys(operation.callbacks || {}).map(function (identifier) {
|
|
8
33
|
// spreads the contents again so there's not nested arrays returned
|
|
9
34
|
return []
|
|
10
|
-
.concat.apply([], Object.keys(operation.callbacks[identifier]).map(function (expression) {
|
|
35
|
+
.concat.apply([], __spreadArray([], __read(Object.keys(operation.callbacks[identifier]).map(function (expression) {
|
|
11
36
|
return Object.keys(operation.callbacks[identifier][expression]).map(function (method) {
|
|
12
37
|
var example = getResponseExamples(operation.callbacks[identifier][expression][method]);
|
|
13
38
|
if (example.length === 0)
|
|
@@ -19,6 +44,6 @@ module.exports = function (operation) {
|
|
|
19
44
|
example: example
|
|
20
45
|
};
|
|
21
46
|
});
|
|
22
|
-
})).filter(Boolean);
|
|
23
|
-
}));
|
|
47
|
+
})), false)).filter(Boolean);
|
|
48
|
+
})), false));
|
|
24
49
|
};
|
|
@@ -9,6 +9,31 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
12
37
|
var getSchema = require('../lib/get-schema');
|
|
13
38
|
var isJSON = require('../lib/matches-mimetype').json;
|
|
14
39
|
var toJSONSchema = require('../lib/openapi-to-json-schema');
|
|
@@ -252,7 +277,7 @@ module.exports = function (path, operation, oas, globalDefaults) {
|
|
|
252
277
|
var components = getComponents();
|
|
253
278
|
var typeKeys = Object.keys(types);
|
|
254
279
|
return (_a = [getRequestBody()])
|
|
255
|
-
.concat.apply(_a, getParameters()).filter(Boolean)
|
|
280
|
+
.concat.apply(_a, __spreadArray([], __read(getParameters()), false)).filter(Boolean)
|
|
256
281
|
.map(function (group) {
|
|
257
282
|
// Since this library assumes that the schema has already been dereferenced, adding every component here that
|
|
258
283
|
// **isn't** circular adds a ton of bloat so it'd be cool if `components` was just the remaining `$ref` pointers
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED