next-openapi-gen 0.4.1 → 0.4.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/README.md
CHANGED
|
@@ -35,12 +35,12 @@ npm install next-openapi-gen --save-dev
|
|
|
35
35
|
npx next-openapi-gen init --ui scalar --docs-url api-docs
|
|
36
36
|
|
|
37
37
|
# Generate OpenAPI documentation
|
|
38
|
-
npx next-openapi generate
|
|
38
|
+
npx next-openapi-gen generate
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## Configuration
|
|
42
42
|
|
|
43
|
-
During initialization (`npx next-openapi init`), a configuration file `next.openapi.json` will be created in the project's root directory:
|
|
43
|
+
During initialization (`npx next-openapi-gen init`), a configuration file `next.openapi.json` will be created in the project's root directory:
|
|
44
44
|
|
|
45
45
|
```json
|
|
46
46
|
{
|
|
@@ -160,7 +160,7 @@ export async function GET(
|
|
|
160
160
|
### 1. Initialization
|
|
161
161
|
|
|
162
162
|
```bash
|
|
163
|
-
npx next-openapi init
|
|
163
|
+
npx next-openapi-gen init
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
This command will generate following elements:
|
|
@@ -171,7 +171,7 @@ This command will generate following elements:
|
|
|
171
171
|
### 2. Generate Documentation
|
|
172
172
|
|
|
173
173
|
```bash
|
|
174
|
-
npx next-openapi generate
|
|
174
|
+
npx next-openapi-gen generate
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
This command will generate OpenAPI documentation based on your API code:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import fs from "fs";
|
|
3
|
-
import { RouteProcessor } from "./route-processor";
|
|
4
|
-
import { cleanSpec } from "./utils";
|
|
3
|
+
import { RouteProcessor } from "./route-processor.js";
|
|
4
|
+
import { cleanSpec } from "./utils.js";
|
|
5
5
|
export class OpenApiGenerator {
|
|
6
6
|
config;
|
|
7
7
|
template;
|
|
@@ -14,7 +14,7 @@ export class OpenApiGenerator {
|
|
|
14
14
|
}
|
|
15
15
|
getConfig() {
|
|
16
16
|
// @ts-ignore
|
|
17
|
-
const { apiDir, schemaDir, docsUrl, ui, outputFile, includeOpenApiRoutes, schemaType = "typescript"
|
|
17
|
+
const { apiDir, schemaDir, docsUrl, ui, outputFile, includeOpenApiRoutes, schemaType = "typescript" } = this.template;
|
|
18
18
|
return {
|
|
19
19
|
apiDir,
|
|
20
20
|
schemaDir,
|
|
@@ -3,7 +3,7 @@ import path from "path";
|
|
|
3
3
|
import { parse } from "@babel/parser";
|
|
4
4
|
import traverse from "@babel/traverse";
|
|
5
5
|
import * as t from "@babel/types";
|
|
6
|
-
import { ZodSchemaConverter } from "./zod-converter";
|
|
6
|
+
import { ZodSchemaConverter } from "./zod-converter.js";
|
|
7
7
|
export class SchemaProcessor {
|
|
8
8
|
schemaDir;
|
|
9
9
|
typeDefinitions = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-openapi-gen",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Automatically generate OpenAPI 3.0 documentation from Next.js projects, with support for both TypeScript types and Zod schemas.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|