oas 32.1.3 → 32.1.4
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/dist/analyzer/index.cjs +5 -5
- package/dist/analyzer/index.js +3 -3
- package/dist/{chunk-LCRF6RES.cjs → chunk-3IEA3ASV.cjs} +33 -21
- package/dist/{chunk-LCRF6RES.cjs.map → chunk-3IEA3ASV.cjs.map} +1 -1
- package/dist/{chunk-Y3ZBOLMA.cjs → chunk-774CH4GG.cjs} +19 -19
- package/dist/{chunk-Y3ZBOLMA.cjs.map → chunk-774CH4GG.cjs.map} +1 -1
- package/dist/{chunk-TBIEIVIF.cjs → chunk-I2TE44UE.cjs} +100 -92
- package/dist/chunk-I2TE44UE.cjs.map +1 -0
- package/dist/{chunk-6IAHMKE7.js → chunk-JEOL436F.js} +17 -9
- package/dist/{chunk-6IAHMKE7.js.map → chunk-JEOL436F.js.map} +1 -1
- package/dist/{chunk-77NXOTZH.js → chunk-TM55HFEL.js} +33 -21
- package/dist/{chunk-77NXOTZH.js.map → chunk-TM55HFEL.js.map} +1 -1
- package/dist/{chunk-FEWSTRYU.js → chunk-TY4JJJU6.js} +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +3 -3
- package/dist/operation/index.cjs +3 -3
- package/dist/operation/index.js +2 -2
- package/dist/reducer/index.cjs +7 -7
- package/dist/reducer/index.js +1 -1
- package/dist/utils.cjs +2 -2
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-TBIEIVIF.cjs.map +0 -1
- /package/dist/{chunk-FEWSTRYU.js.map → chunk-TY4JJJU6.js.map} +0 -0
package/dist/analyzer/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var _chunk774CH4GGcjs = require('../chunk-774CH4GG.cjs');
|
|
4
|
+
require('../chunk-I2TE44UE.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkW6GBV2JTcjs = require('../chunk-W6GBV2JT.cjs');
|
|
9
|
-
require('../chunk-
|
|
9
|
+
require('../chunk-3IEA3ASV.cjs');
|
|
10
10
|
require('../chunk-AYA3UT4L.cjs');
|
|
11
11
|
require('../chunk-YPR7YTHM.cjs');
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ function callbacks(definition) {
|
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
async function circularRefs(definition) {
|
|
23
|
-
const oas = new (0,
|
|
23
|
+
const oas = new (0, _chunk774CH4GGcjs.Oas)(structuredClone(definition));
|
|
24
24
|
await oas.dereference();
|
|
25
25
|
const results = oas.getCircularReferences();
|
|
26
26
|
results.sort();
|
|
@@ -33,7 +33,7 @@ function discriminators(definition) {
|
|
|
33
33
|
return _chunkW6GBV2JTcjs.query.call(void 0, ["$..discriminator"], definition).map((res) => _chunkW6GBV2JTcjs.refizePointer.call(void 0, res.pointer));
|
|
34
34
|
}
|
|
35
35
|
async function fileSize(definition) {
|
|
36
|
-
const oas = new (0,
|
|
36
|
+
const oas = new (0, _chunk774CH4GGcjs.Oas)(structuredClone(definition));
|
|
37
37
|
const originalSizeInBytes = Buffer.from(JSON.stringify(oas.api)).length;
|
|
38
38
|
const raw = Number((originalSizeInBytes / (1024 * 1024)).toFixed(2));
|
|
39
39
|
await oas.dereference();
|
package/dist/analyzer/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Oas
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-TY4JJJU6.js";
|
|
4
|
+
import "../chunk-JEOL436F.js";
|
|
5
5
|
import {
|
|
6
6
|
query,
|
|
7
7
|
refizePointer
|
|
8
8
|
} from "../chunk-CKC36IL7.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-TM55HFEL.js";
|
|
10
10
|
import "../chunk-S27IGTVG.js";
|
|
11
11
|
import "../chunk-MNOEMVCF.js";
|
|
12
12
|
|
|
@@ -1012,9 +1012,9 @@ var types = {
|
|
|
1012
1012
|
// This a special type reserved for https://npm.im/api
|
|
1013
1013
|
};
|
|
1014
1014
|
function getParametersAsJSONSchema(operation, api, opts) {
|
|
1015
|
-
const usedSchemas = /* @__PURE__ */ new Map();
|
|
1016
1015
|
const seenRefs = /* @__PURE__ */ new Set();
|
|
1017
1016
|
const refsByGroup = /* @__PURE__ */ new Map();
|
|
1017
|
+
const usedSchemasByGroup = /* @__PURE__ */ new Map();
|
|
1018
1018
|
function refLoggerForSchemaGroup(group) {
|
|
1019
1019
|
let set = refsByGroup.get(group);
|
|
1020
1020
|
if (!set) {
|
|
@@ -1023,13 +1023,20 @@ function getParametersAsJSONSchema(operation, api, opts) {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
return set;
|
|
1025
1025
|
}
|
|
1026
|
+
function usedSchemasForSchemaGroup(group) {
|
|
1027
|
+
let map = usedSchemasByGroup.get(group);
|
|
1028
|
+
if (!map) {
|
|
1029
|
+
map = /* @__PURE__ */ new Map();
|
|
1030
|
+
usedSchemasByGroup.set(group, map);
|
|
1031
|
+
}
|
|
1032
|
+
return map;
|
|
1033
|
+
}
|
|
1026
1034
|
const baseSchemaOptions = {
|
|
1027
1035
|
definition: api,
|
|
1028
1036
|
globalDefaults: _optionalChain([opts, 'optionalAccess', _33 => _33.globalDefaults]),
|
|
1029
1037
|
hideReadOnlyProperties: _optionalChain([opts, 'optionalAccess', _34 => _34.hideReadOnlyProperties]),
|
|
1030
1038
|
hideWriteOnlyProperties: _optionalChain([opts, 'optionalAccess', _35 => _35.hideWriteOnlyProperties]),
|
|
1031
|
-
seenRefs
|
|
1032
|
-
usedSchemas
|
|
1039
|
+
seenRefs
|
|
1033
1040
|
};
|
|
1034
1041
|
function transformRequestBody() {
|
|
1035
1042
|
const requestBody = operation.getRequestBody();
|
|
@@ -1058,6 +1065,7 @@ function getParametersAsJSONSchema(operation, api, opts) {
|
|
|
1058
1065
|
const requestSchema = cloneObject(mediaTypeObject.schema);
|
|
1059
1066
|
const cleanedSchema = toJSONSchema(requestSchema, {
|
|
1060
1067
|
...baseSchemaOptions,
|
|
1068
|
+
usedSchemas: usedSchemasForSchemaGroup(type),
|
|
1061
1069
|
prevExampleSchemas,
|
|
1062
1070
|
refLogger: (ref) => refLoggerForSchemaGroup(type).add(ref)
|
|
1063
1071
|
});
|
|
@@ -1094,6 +1102,7 @@ function getParametersAsJSONSchema(operation, api, opts) {
|
|
|
1094
1102
|
if (current.deprecated) currentSchema.deprecated = current.deprecated;
|
|
1095
1103
|
const interimSchema = toJSONSchema(currentSchema, {
|
|
1096
1104
|
...baseSchemaOptions,
|
|
1105
|
+
usedSchemas: usedSchemasForSchemaGroup(type),
|
|
1097
1106
|
currentLocation: `/${current.name}`,
|
|
1098
1107
|
refLogger: (ref) => refLoggerForSchemaGroup(type).add(ref)
|
|
1099
1108
|
});
|
|
@@ -1112,6 +1121,7 @@ function getParametersAsJSONSchema(operation, api, opts) {
|
|
|
1112
1121
|
if (current.deprecated) currentSchema.deprecated = current.deprecated;
|
|
1113
1122
|
const interimSchema = toJSONSchema(currentSchema, {
|
|
1114
1123
|
...baseSchemaOptions,
|
|
1124
|
+
usedSchemas: usedSchemasForSchemaGroup(type),
|
|
1115
1125
|
currentLocation: `/${current.name}`,
|
|
1116
1126
|
refLogger: (ref) => refLoggerForSchemaGroup(type).add(ref)
|
|
1117
1127
|
});
|
|
@@ -1164,25 +1174,27 @@ function getParametersAsJSONSchema(operation, api, opts) {
|
|
|
1164
1174
|
typeKeys[typeKeys.indexOf("form")] = "formData";
|
|
1165
1175
|
typeKeys.push("metadata");
|
|
1166
1176
|
const jsonSchema = [transformRequestBody()].concat(...transformParameters()).filter((item) => item !== null);
|
|
1167
|
-
applyDiscriminatorOneOfToUsedSchemas(api, usedSchemas, (ref) => {
|
|
1168
|
-
if (usedSchemas.has(ref)) {
|
|
1169
|
-
return usedSchemas.get(ref);
|
|
1170
|
-
}
|
|
1171
|
-
try {
|
|
1172
|
-
const resolved = dereferenceRef({ $ref: ref }, api, seenRefs);
|
|
1173
|
-
if (_chunkYPR7YTHMcjs.isRef.call(void 0, resolved)) return void 0;
|
|
1174
|
-
const converted = toJSONSchema(structuredClone(resolved), {
|
|
1175
|
-
...baseSchemaOptions,
|
|
1176
|
-
seenRefs
|
|
1177
|
-
});
|
|
1178
|
-
usedSchemas.set(ref, converted);
|
|
1179
|
-
return converted;
|
|
1180
|
-
} catch (e10) {
|
|
1181
|
-
return void 0;
|
|
1182
|
-
}
|
|
1183
|
-
});
|
|
1184
1177
|
return jsonSchema.map((group) => {
|
|
1185
1178
|
if (group.schema && typeof group.schema === "object") {
|
|
1179
|
+
const usedSchemas = _nullishCoalesce(usedSchemasByGroup.get(group.type), () => ( /* @__PURE__ */ new Map()));
|
|
1180
|
+
applyDiscriminatorOneOfToUsedSchemas(api, usedSchemas, (ref) => {
|
|
1181
|
+
if (usedSchemas.has(ref)) {
|
|
1182
|
+
return usedSchemas.get(ref);
|
|
1183
|
+
}
|
|
1184
|
+
try {
|
|
1185
|
+
const resolved = dereferenceRef({ $ref: ref }, api, seenRefs);
|
|
1186
|
+
if (_chunkYPR7YTHMcjs.isRef.call(void 0, resolved)) return void 0;
|
|
1187
|
+
const converted = toJSONSchema(structuredClone(resolved), {
|
|
1188
|
+
...baseSchemaOptions,
|
|
1189
|
+
usedSchemas,
|
|
1190
|
+
seenRefs
|
|
1191
|
+
});
|
|
1192
|
+
usedSchemas.set(ref, converted);
|
|
1193
|
+
return converted;
|
|
1194
|
+
} catch (e10) {
|
|
1195
|
+
return void 0;
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1186
1198
|
const refsInGroup = _nullishCoalesce(refsByGroup.get(group.type), () => ( /* @__PURE__ */ new Set()));
|
|
1187
1199
|
const referencedSchemas = filterRequiredRefsToReferenced(refsInGroup, usedSchemas);
|
|
1188
1200
|
if (referencedSchemas.size > 0) {
|
|
@@ -1219,4 +1231,4 @@ var SERVER_VARIABLE_REGEX = /{([-_a-zA-Z0-9:.[\]]+)}/g;
|
|
|
1219
1231
|
|
|
1220
1232
|
|
|
1221
1233
|
exports.isObject = isObject; exports.isPrimitive = isPrimitive; exports.decorateComponentSchemasWithRefName = decorateComponentSchemasWithRefName; exports.decodePointer = decodePointer; exports.dereferenceRef = dereferenceRef; exports.getDereferencingOptions = getDereferencingOptions; exports.filterRequiredRefsToReferenced = filterRequiredRefsToReferenced; exports.mergeReferencedSchemasIntoRoot = mergeReferencedSchemasIntoRoot; exports.matches_mimetype_default = matches_mimetype_default; exports.getParameterContentType = getParameterContentType; exports.cloneObject = cloneObject; exports.applyDiscriminatorOneOfToUsedSchemas = applyDiscriminatorOneOfToUsedSchemas; exports.getSchemaVersionString = getSchemaVersionString; exports.toJSONSchema = toJSONSchema; exports.types = types; exports.getParametersAsJSONSchema = getParametersAsJSONSchema; exports.supportedMethods = supportedMethods; exports.SERVER_VARIABLE_REGEX = SERVER_VARIABLE_REGEX;
|
|
1222
|
-
//# sourceMappingURL=chunk-
|
|
1234
|
+
//# sourceMappingURL=chunk-3IEA3ASV.cjs.map
|