next-openapi-gen 0.10.4 → 1.0.0
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/cli.d.ts +4 -0
- package/dist/cli.js +8599 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +8645 -26
- package/dist/next/index.d.ts +1 -0
- package/dist/next/index.js +7965 -0
- package/dist/react-router/index.d.ts +1 -0
- package/dist/react-router/index.js +7134 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +7134 -0
- package/package.json +102 -79
- package/{dist/components/rapidoc.js → templates/init/ui/nextjs/rapidoc.tsx} +16 -20
- package/templates/init/ui/nextjs/redoc.tsx +11 -0
- package/{dist/components/scalar.js → templates/init/ui/nextjs/scalar.tsx} +15 -21
- package/{dist/components/stoplight.js → templates/init/ui/nextjs/stoplight.tsx} +11 -17
- package/templates/init/ui/nextjs/swagger.tsx +17 -0
- package/templates/init/ui/reactrouter/rapidoc.tsx +15 -0
- package/templates/init/ui/reactrouter/redoc.tsx +9 -0
- package/templates/init/ui/reactrouter/scalar.tsx +14 -0
- package/templates/init/ui/reactrouter/stoplight.tsx +10 -0
- package/templates/init/ui/reactrouter/swagger.tsx +11 -0
- package/templates/init/ui/tanstack/rapidoc.tsx +21 -0
- package/templates/init/ui/tanstack/redoc.tsx +14 -0
- package/templates/init/ui/tanstack/scalar.tsx +19 -0
- package/templates/init/ui/tanstack/stoplight.tsx +15 -0
- package/templates/init/ui/tanstack/swagger.tsx +16 -0
- package/templates/init/ui/template-types.d.ts +9 -0
- package/README.md +0 -1047
- package/dist/commands/generate.js +0 -24
- package/dist/commands/init.js +0 -194
- package/dist/components/redoc.js +0 -17
- package/dist/components/swagger.js +0 -21
- package/dist/lib/app-router-strategy.js +0 -66
- package/dist/lib/drizzle-zod-processor.js +0 -329
- package/dist/lib/logger.js +0 -39
- package/dist/lib/openapi-generator.js +0 -171
- package/dist/lib/pages-router-strategy.js +0 -198
- package/dist/lib/route-processor.js +0 -347
- package/dist/lib/router-strategy.js +0 -1
- package/dist/lib/schema-processor.js +0 -1612
- package/dist/lib/utils.js +0 -284
- package/dist/lib/zod-converter.js +0 -2133
- package/dist/openapi-template.js +0 -99
- package/dist/types.js +0 -1
package/package.json
CHANGED
|
@@ -1,79 +1,102 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "next-openapi-gen",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Automatically generate OpenAPI 3.0 documentation from Next.js projects, with support for Zod schemas and
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"@types
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"typescript": "^5.9.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "next-openapi-gen",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Automatically generate OpenAPI 3.0, 3.1, and 3.2 documentation from Next.js projects, with support for Zod schemas, TypeScript types, and reusable OpenAPI fragments.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"api",
|
|
7
|
+
"api-docs",
|
|
8
|
+
"docs",
|
|
9
|
+
"drizzle",
|
|
10
|
+
"nextjs",
|
|
11
|
+
"openapi",
|
|
12
|
+
"react",
|
|
13
|
+
"redoc",
|
|
14
|
+
"scalar",
|
|
15
|
+
"swagger",
|
|
16
|
+
"typescript",
|
|
17
|
+
"zod"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Mariusz Winnik",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+ssh://git@github.com/tazo90/next-openapi-gen.git"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"next-openapi-gen": "./dist/cli.js",
|
|
27
|
+
"openapi-gen": "./dist/cli.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"templates"
|
|
32
|
+
],
|
|
33
|
+
"type": "module",
|
|
34
|
+
"main": "dist/index.js",
|
|
35
|
+
"module": "dist/index.js",
|
|
36
|
+
"typings": "dist/index.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./next": {
|
|
43
|
+
"types": "./dist/next/index.d.ts",
|
|
44
|
+
"default": "./dist/next/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./react-router": {
|
|
47
|
+
"types": "./dist/react-router/index.d.ts",
|
|
48
|
+
"default": "./dist/react-router/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./vite": {
|
|
51
|
+
"types": "./dist/vite/index.d.ts",
|
|
52
|
+
"default": "./dist/vite/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./package.json": "./package.json"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@babel/parser": "^7.29.2",
|
|
61
|
+
"@babel/traverse": "^7.29.0",
|
|
62
|
+
"@babel/types": "^7.29.0",
|
|
63
|
+
"commander": "^14.0.3",
|
|
64
|
+
"fs-extra": "^11.3.4",
|
|
65
|
+
"js-yaml": "^4.1.1",
|
|
66
|
+
"ora": "^9.3.0",
|
|
67
|
+
"typescript": "^5.9.3"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@types/node": "^25.5.0",
|
|
71
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
72
|
+
"np": "^11.0.2",
|
|
73
|
+
"oxfmt": "^0.42.0",
|
|
74
|
+
"oxlint": "^1.57.0",
|
|
75
|
+
"tsup": "^8.5.1"
|
|
76
|
+
},
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=24.0.0"
|
|
79
|
+
},
|
|
80
|
+
"np": {
|
|
81
|
+
"packageManager": "pnpm",
|
|
82
|
+
"anyBranch": false,
|
|
83
|
+
"branch": "main",
|
|
84
|
+
"cleanup": false,
|
|
85
|
+
"tests": false,
|
|
86
|
+
"2fa": false,
|
|
87
|
+
"releaseDraft": false
|
|
88
|
+
},
|
|
89
|
+
"scripts": {
|
|
90
|
+
"check": "pnpm format:check && pnpm lint",
|
|
91
|
+
"clean": "rm -rf dist coverage templates tsconfig.tsbuildinfo",
|
|
92
|
+
"build": "pnpm clean && tsup --config tsup.config.ts && cp -R ../openapi-init/templates ./templates",
|
|
93
|
+
"format": "oxfmt --config ../oxfmt-config/oxfmt.json --ignore-path ../../.gitignore .",
|
|
94
|
+
"format:check": "oxfmt --config ../oxfmt-config/oxfmt.json --ignore-path ../../.gitignore --check .",
|
|
95
|
+
"lint": "oxlint --config ../oxlint-config/base.json . --ignore-path ../../.gitignore --deny-warnings",
|
|
96
|
+
"lint:fix": "oxlint --config ../oxlint-config/base.json . --ignore-path ../../.gitignore --fix --deny-warnings",
|
|
97
|
+
"test": "pnpm --dir ../.. test:unit && pnpm --dir ../.. test:integration",
|
|
98
|
+
"test:coverage": "pnpm --dir ../.. test:coverage:next-openapi-gen",
|
|
99
|
+
"release": "np --no-cleanup --no-tests --no-publish",
|
|
100
|
+
"version": "conventional-changelog -p angular -i ../../CHANGELOG.md -s -n ../../.changelogrc.cjs && git add ../../CHANGELOG.md"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</section>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import "rapidoc";
|
|
4
|
+
|
|
5
|
+
const RapiDoc = "rapi-doc" as any;
|
|
6
|
+
|
|
7
|
+
export default function ApiDocsPage() {
|
|
8
|
+
return (
|
|
9
|
+
<section style={{ height: "100vh" }}>
|
|
10
|
+
<RapiDoc
|
|
11
|
+
spec-url="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__"
|
|
12
|
+
render-style="read"
|
|
13
|
+
style={{ height: "100vh", width: "100%" }}
|
|
14
|
+
></RapiDoc>
|
|
15
|
+
</section>
|
|
16
|
+
);
|
|
21
17
|
}
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
url: "/${outputFile}",
|
|
17
|
-
}}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ApiReferenceReact } from "@scalar/api-reference-react";
|
|
4
|
+
|
|
5
|
+
import "@scalar/api-reference-react/style.css";
|
|
6
|
+
|
|
7
|
+
export default function ApiDocsPage() {
|
|
8
|
+
return (
|
|
9
|
+
<ApiReferenceReact
|
|
10
|
+
configuration={{
|
|
11
|
+
_integration: "nextjs",
|
|
12
|
+
url: "/__NEXT_OPENAPI_GEN_OUTPUT_FILE__",
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
22
16
|
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<section style={{ height: "100vh" }}>
|
|
13
|
-
<API apiDescriptionUrl="${outputFile}" />
|
|
14
|
-
</section>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { API } from "@stoplight/elements";
|
|
4
|
+
import "@stoplight/elements/styles.min.css";
|
|
5
|
+
|
|
6
|
+
export default function ApiDocsPage() {
|
|
7
|
+
return (
|
|
8
|
+
<section style={{ height: "100vh" }}>
|
|
9
|
+
<API apiDescriptionUrl="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__" />
|
|
10
|
+
</section>
|
|
11
|
+
);
|
|
18
12
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import "swagger-ui-react/swagger-ui.css";
|
|
4
|
+
|
|
5
|
+
import dynamic from "next/dynamic";
|
|
6
|
+
|
|
7
|
+
const SwaggerUI = dynamic(() => import("swagger-ui-react"), {
|
|
8
|
+
loading: () => <p>Loading Component...</p>,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default function ApiDocsPage() {
|
|
12
|
+
return (
|
|
13
|
+
<section>
|
|
14
|
+
<SwaggerUI url="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__" />
|
|
15
|
+
</section>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "rapidoc";
|
|
2
|
+
|
|
3
|
+
const RapiDoc = "rapi-doc" as any;
|
|
4
|
+
|
|
5
|
+
export default function ApiDocsPage() {
|
|
6
|
+
return (
|
|
7
|
+
<section style={{ height: "100vh" }}>
|
|
8
|
+
<RapiDoc
|
|
9
|
+
spec-url="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__"
|
|
10
|
+
render-style="read"
|
|
11
|
+
style={{ height: "100vh", width: "100%" }}
|
|
12
|
+
></RapiDoc>
|
|
13
|
+
</section>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiReferenceReact } from "@scalar/api-reference-react";
|
|
2
|
+
|
|
3
|
+
import "@scalar/api-reference-react/style.css";
|
|
4
|
+
|
|
5
|
+
export default function ApiDocsPage() {
|
|
6
|
+
return (
|
|
7
|
+
<ApiReferenceReact
|
|
8
|
+
configuration={{
|
|
9
|
+
_integration: "react",
|
|
10
|
+
url: "/__NEXT_OPENAPI_GEN_OUTPUT_FILE__",
|
|
11
|
+
}}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { API } from "@stoplight/elements";
|
|
2
|
+
import "@stoplight/elements/styles.min.css";
|
|
3
|
+
|
|
4
|
+
export default function ApiDocsPage() {
|
|
5
|
+
return (
|
|
6
|
+
<section style={{ height: "100vh" }}>
|
|
7
|
+
<API apiDescriptionUrl="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__" />
|
|
8
|
+
</section>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
|
|
3
|
+
import "rapidoc";
|
|
4
|
+
|
|
5
|
+
const RapiDoc = "rapi-doc" as any;
|
|
6
|
+
|
|
7
|
+
export const Route = createFileRoute("__NEXT_OPENAPI_GEN_ROUTE_PATH__")({
|
|
8
|
+
component: ApiDocsPage,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
function ApiDocsPage() {
|
|
12
|
+
return (
|
|
13
|
+
<section style={{ height: "100vh" }}>
|
|
14
|
+
<RapiDoc
|
|
15
|
+
spec-url="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__"
|
|
16
|
+
render-style="read"
|
|
17
|
+
style={{ height: "100vh", width: "100%" }}
|
|
18
|
+
></RapiDoc>
|
|
19
|
+
</section>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { RedocStandalone } from "redoc";
|
|
3
|
+
|
|
4
|
+
export const Route = createFileRoute("__NEXT_OPENAPI_GEN_ROUTE_PATH__")({
|
|
5
|
+
component: ApiDocsPage,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
function ApiDocsPage() {
|
|
9
|
+
return (
|
|
10
|
+
<section>
|
|
11
|
+
<RedocStandalone specUrl="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__" />
|
|
12
|
+
</section>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { ApiReferenceReact } from "@scalar/api-reference-react";
|
|
3
|
+
|
|
4
|
+
import "@scalar/api-reference-react/style.css";
|
|
5
|
+
|
|
6
|
+
export const Route = createFileRoute("__NEXT_OPENAPI_GEN_ROUTE_PATH__")({
|
|
7
|
+
component: ApiDocsPage,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
function ApiDocsPage() {
|
|
11
|
+
return (
|
|
12
|
+
<ApiReferenceReact
|
|
13
|
+
configuration={{
|
|
14
|
+
_integration: "react",
|
|
15
|
+
url: "/__NEXT_OPENAPI_GEN_OUTPUT_FILE__",
|
|
16
|
+
}}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
+
import { API } from "@stoplight/elements";
|
|
3
|
+
import "@stoplight/elements/styles.min.css";
|
|
4
|
+
|
|
5
|
+
export const Route = createFileRoute("__NEXT_OPENAPI_GEN_ROUTE_PATH__")({
|
|
6
|
+
component: ApiDocsPage,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function ApiDocsPage() {
|
|
10
|
+
return (
|
|
11
|
+
<section style={{ height: "100vh" }}>
|
|
12
|
+
<API apiDescriptionUrl="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__" />
|
|
13
|
+
</section>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "swagger-ui-react/swagger-ui.css";
|
|
2
|
+
|
|
3
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
4
|
+
import SwaggerUI from "swagger-ui-react";
|
|
5
|
+
|
|
6
|
+
export const Route = createFileRoute("__NEXT_OPENAPI_GEN_ROUTE_PATH__")({
|
|
7
|
+
component: ApiDocsPage,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
function ApiDocsPage() {
|
|
11
|
+
return (
|
|
12
|
+
<section>
|
|
13
|
+
<SwaggerUI url="/__NEXT_OPENAPI_GEN_OUTPUT_FILE__" />
|
|
14
|
+
</section>
|
|
15
|
+
);
|
|
16
|
+
}
|