@spikers/next-openapi-json-generator 1.1.1 → 1.1.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/dist/index.cjs +3 -8
- package/dist/index.js +3 -8
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,6 @@ module.exports = __toCommonJS(index_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/core/generateOpenApiSpec.ts
|
|
38
38
|
var import_node_path4 = __toESM(require("path"), 1);
|
|
39
|
-
var import_package_metadata = __toESM(require("@omer-x/package-metadata"), 1);
|
|
40
39
|
|
|
41
40
|
// src/utils/object.ts
|
|
42
41
|
function omit(object, ...keys) {
|
|
@@ -415,10 +414,7 @@ function createRouteRecord(method, filePath, rootPath, apiData) {
|
|
|
415
414
|
};
|
|
416
415
|
}
|
|
417
416
|
function bundlePaths(source, storedSchemas) {
|
|
418
|
-
source.sort((a, b) =>
|
|
419
|
-
const methodComparison = a.method.localeCompare(b.method);
|
|
420
|
-
return methodComparison !== 0 ? methodComparison : a.path.localeCompare(b.path);
|
|
421
|
-
});
|
|
417
|
+
source.sort((a, b) => a.path.localeCompare(b.path));
|
|
422
418
|
return source.reduce((collection, route) => ({
|
|
423
419
|
...collection,
|
|
424
420
|
[route.path]: {
|
|
@@ -475,7 +471,6 @@ async function generateOpenApiSpec(schemas, {
|
|
|
475
471
|
));
|
|
476
472
|
}
|
|
477
473
|
}
|
|
478
|
-
const metadata = (0, import_package_metadata.default)();
|
|
479
474
|
const pathsAndComponents = {
|
|
480
475
|
paths: bundlePaths(validRoutes, schemas),
|
|
481
476
|
components: {
|
|
@@ -486,8 +481,8 @@ async function generateOpenApiSpec(schemas, {
|
|
|
486
481
|
return {
|
|
487
482
|
openapi: "3.1.0",
|
|
488
483
|
info: {
|
|
489
|
-
title:
|
|
490
|
-
version:
|
|
484
|
+
title: "API Documentation",
|
|
485
|
+
version: "1.0.0",
|
|
491
486
|
...info ?? {}
|
|
492
487
|
},
|
|
493
488
|
servers,
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
7
|
|
|
8
8
|
// src/core/generateOpenApiSpec.ts
|
|
9
9
|
import path4 from "path";
|
|
10
|
-
import getPackageMetadata from "@omer-x/package-metadata";
|
|
11
10
|
|
|
12
11
|
// src/utils/object.ts
|
|
13
12
|
function omit(object, ...keys) {
|
|
@@ -386,10 +385,7 @@ function createRouteRecord(method, filePath, rootPath, apiData) {
|
|
|
386
385
|
};
|
|
387
386
|
}
|
|
388
387
|
function bundlePaths(source, storedSchemas) {
|
|
389
|
-
source.sort((a, b) =>
|
|
390
|
-
const methodComparison = a.method.localeCompare(b.method);
|
|
391
|
-
return methodComparison !== 0 ? methodComparison : a.path.localeCompare(b.path);
|
|
392
|
-
});
|
|
388
|
+
source.sort((a, b) => a.path.localeCompare(b.path));
|
|
393
389
|
return source.reduce((collection, route) => ({
|
|
394
390
|
...collection,
|
|
395
391
|
[route.path]: {
|
|
@@ -446,7 +442,6 @@ async function generateOpenApiSpec(schemas, {
|
|
|
446
442
|
));
|
|
447
443
|
}
|
|
448
444
|
}
|
|
449
|
-
const metadata = getPackageMetadata();
|
|
450
445
|
const pathsAndComponents = {
|
|
451
446
|
paths: bundlePaths(validRoutes, schemas),
|
|
452
447
|
components: {
|
|
@@ -457,8 +452,8 @@ async function generateOpenApiSpec(schemas, {
|
|
|
457
452
|
return {
|
|
458
453
|
openapi: "3.1.0",
|
|
459
454
|
info: {
|
|
460
|
-
title:
|
|
461
|
-
version:
|
|
455
|
+
title: "API Documentation",
|
|
456
|
+
version: "1.0.0",
|
|
462
457
|
...info ?? {}
|
|
463
458
|
},
|
|
464
459
|
servers,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spikers/next-openapi-json-generator",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "a Next.js plugin to generate OpenAPI documentation from route handlers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"next.js",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"build": "tsup"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@omer-x/package-metadata": "^1.0.2",
|
|
44
43
|
"minimatch": "^10.0.1",
|
|
45
44
|
"typescript": "^5.7.2",
|
|
46
45
|
"zod-to-json-schema": "^3.24.1"
|