@scalar/fastify-api-reference 1.25.83 → 1.25.86
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 +11 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +39 -22
- package/dist/js/standalone.js +1059 -1052
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -12430,6 +12430,13 @@ jsonSchema202012.default = addMetaSchema2020;
|
|
|
12430
12430
|
var _2020Exports = _2020.exports;
|
|
12431
12431
|
const Ajv2020 = /* @__PURE__ */ getDefaultExportFromCjs(_2020Exports);
|
|
12432
12432
|
function details$1(specification) {
|
|
12433
|
+
if (specification === null) {
|
|
12434
|
+
return {
|
|
12435
|
+
version: void 0,
|
|
12436
|
+
specificationType: void 0,
|
|
12437
|
+
specificationVersion: void 0
|
|
12438
|
+
};
|
|
12439
|
+
}
|
|
12433
12440
|
for (const version of new Set(OpenApiVersions)) {
|
|
12434
12441
|
const specificationType = version === "2.0" ? "swagger" : "openapi";
|
|
12435
12442
|
const value = specification[specificationType];
|
|
@@ -18429,10 +18436,13 @@ function stringify(value, replacer, options) {
|
|
|
18429
18436
|
return new Document(value, _replacer, options).toString(options);
|
|
18430
18437
|
}
|
|
18431
18438
|
function normalize(specification) {
|
|
18432
|
-
if (
|
|
18433
|
-
return
|
|
18439
|
+
if (specification === null) {
|
|
18440
|
+
return {};
|
|
18434
18441
|
}
|
|
18435
18442
|
if (typeof specification === "string") {
|
|
18443
|
+
if (specification.trim() === "") {
|
|
18444
|
+
return {};
|
|
18445
|
+
}
|
|
18436
18446
|
try {
|
|
18437
18447
|
return JSON.parse(specification);
|
|
18438
18448
|
} catch (error2) {
|
|
@@ -18441,6 +18451,9 @@ function normalize(specification) {
|
|
|
18441
18451
|
});
|
|
18442
18452
|
}
|
|
18443
18453
|
}
|
|
18454
|
+
if (isFilesystem(specification)) {
|
|
18455
|
+
return specification;
|
|
18456
|
+
}
|
|
18444
18457
|
return specification;
|
|
18445
18458
|
}
|
|
18446
18459
|
function makeFilesystem(value, overwrites = {}) {
|
|
@@ -19130,9 +19143,8 @@ async function load(value, options) {
|
|
|
19130
19143
|
};
|
|
19131
19144
|
}
|
|
19132
19145
|
function upgradeFromThreeToThreeOne(originalSpecification) {
|
|
19133
|
-
var _a;
|
|
19134
19146
|
let specification = originalSpecification;
|
|
19135
|
-
if (
|
|
19147
|
+
if (specification !== null && typeof specification.openapi === "string" && specification.openapi.startsWith("3.0")) {
|
|
19136
19148
|
specification.openapi = "3.1.1";
|
|
19137
19149
|
} else {
|
|
19138
19150
|
return specification;
|
|
@@ -19221,9 +19233,10 @@ function isSchemaPath(path2) {
|
|
|
19221
19233
|
return path2.includes(location);
|
|
19222
19234
|
}) || path2.includes("schema") || path2.some((segment) => segment.endsWith("Schema"));
|
|
19223
19235
|
}
|
|
19224
|
-
function upgradeFromTwoToThree(
|
|
19236
|
+
function upgradeFromTwoToThree(originalSpecification) {
|
|
19225
19237
|
var _a, _b, _c;
|
|
19226
|
-
|
|
19238
|
+
let specification = originalSpecification;
|
|
19239
|
+
if (specification !== null && typeof specification.swagger === "string" && ((_a = specification.swagger) == null ? void 0 : _a.startsWith("2.0"))) {
|
|
19227
19240
|
specification.openapi = "3.0.4";
|
|
19228
19241
|
delete specification.swagger;
|
|
19229
19242
|
} else {
|
|
@@ -19231,7 +19244,7 @@ function upgradeFromTwoToThree(specification) {
|
|
|
19231
19244
|
}
|
|
19232
19245
|
console.warn(`[upgradeFromTwoToThree] The upgrade from Swagger 2.0 to OpenAPI 3.0 documents is experimental and lacks features.`);
|
|
19233
19246
|
if (specification.host) {
|
|
19234
|
-
const schemes2 = ((_b = specification.schemes) == null ? void 0 : _b.length) ? specification.schemes : ["http"];
|
|
19247
|
+
const schemes2 = Array.isArray(specification.schemes) && ((_b = specification.schemes) == null ? void 0 : _b.length) ? specification.schemes : ["http"];
|
|
19235
19248
|
specification.servers = schemes2.map((scheme) => ({
|
|
19236
19249
|
url: `${scheme}://${specification.host}${specification.basePath ?? ""}`
|
|
19237
19250
|
}));
|
|
@@ -19240,10 +19253,9 @@ function upgradeFromTwoToThree(specification) {
|
|
|
19240
19253
|
delete specification.host;
|
|
19241
19254
|
}
|
|
19242
19255
|
if (specification.definitions) {
|
|
19243
|
-
|
|
19244
|
-
specification.
|
|
19245
|
-
}
|
|
19246
|
-
specification.components.schemas = specification.definitions;
|
|
19256
|
+
specification.components = Object.assign({}, specification.components, {
|
|
19257
|
+
schemas: specification.definitions
|
|
19258
|
+
});
|
|
19247
19259
|
delete specification.definitions;
|
|
19248
19260
|
specification = traverse(specification, (schema2) => {
|
|
19249
19261
|
var _a2;
|
|
@@ -19253,7 +19265,7 @@ function upgradeFromTwoToThree(specification) {
|
|
|
19253
19265
|
return schema2;
|
|
19254
19266
|
});
|
|
19255
19267
|
}
|
|
19256
|
-
if (specification.paths) {
|
|
19268
|
+
if (typeof specification.paths === "object") {
|
|
19257
19269
|
for (const path2 in specification.paths) {
|
|
19258
19270
|
if (Object.hasOwn(specification.paths, path2)) {
|
|
19259
19271
|
const pathItem = specification.paths[path2];
|
|
@@ -19345,23 +19357,22 @@ function upgradeFromTwoToThree(specification) {
|
|
|
19345
19357
|
if (typeof specification.components !== "object") {
|
|
19346
19358
|
specification.components = {};
|
|
19347
19359
|
}
|
|
19348
|
-
specification.components
|
|
19360
|
+
specification.components = specification.components;
|
|
19361
|
+
Object.assign(specification.components, { securitySchemes: {} });
|
|
19349
19362
|
for (const [key, securityScheme] of Object.entries(specification.securityDefinitions)) {
|
|
19350
19363
|
if (typeof securityScheme === "object") {
|
|
19351
19364
|
if ("type" in securityScheme && securityScheme.type === "oauth2") {
|
|
19352
19365
|
const { flow, authorizationUrl, tokenUrl, scopes } = securityScheme;
|
|
19353
|
-
specification.components.securitySchemes
|
|
19354
|
-
|
|
19355
|
-
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
...tokenUrl && { tokenUrl },
|
|
19359
|
-
...scopes && { scopes }
|
|
19366
|
+
Object.assign(specification.components.securitySchemes, {
|
|
19367
|
+
[key]: {
|
|
19368
|
+
type: "oauth2",
|
|
19369
|
+
flows: {
|
|
19370
|
+
[flow]: Object.assign({}, authorizationUrl && { authorizationUrl }, tokenUrl && { tokenUrl }, scopes && { scopes })
|
|
19360
19371
|
}
|
|
19361
19372
|
}
|
|
19362
|
-
};
|
|
19373
|
+
});
|
|
19363
19374
|
} else {
|
|
19364
|
-
specification.components.securitySchemes[key]
|
|
19375
|
+
Object.assign(specification.components.securitySchemes, { [key]: securityScheme });
|
|
19365
19376
|
}
|
|
19366
19377
|
}
|
|
19367
19378
|
}
|
|
@@ -19370,6 +19381,12 @@ function upgradeFromTwoToThree(specification) {
|
|
|
19370
19381
|
return specification;
|
|
19371
19382
|
}
|
|
19372
19383
|
function upgrade(value) {
|
|
19384
|
+
if (!value) {
|
|
19385
|
+
return {
|
|
19386
|
+
specification: null,
|
|
19387
|
+
version: "3.1"
|
|
19388
|
+
};
|
|
19389
|
+
}
|
|
19373
19390
|
const upgraders = [upgradeFromTwoToThree, upgradeFromThreeToThreeOne];
|
|
19374
19391
|
const result = upgraders.reduce((currentSpecification, upgrader) => upgrader(currentSpecification), getEntrypoint(makeFilesystem(value)).specification);
|
|
19375
19392
|
return {
|