next-openapi-gen 0.0.13 → 0.0.14
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 +4 -4
- package/dist/commands/init.js +2 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,14 +14,14 @@ With support for multiple user interfaces next-openapi-gen makes documenting you
|
|
|
14
14
|
- Swagger
|
|
15
15
|
- Redoc
|
|
16
16
|
- Stoplight Elements
|
|
17
|
-
-
|
|
17
|
+
- RapiDoc
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
21
|
- **Automatic OpenAPI Generation**: Generate OpenAPI 3.0 documentation from your Next.js routes, automatically parsing TypeScript types for parameters, request bodies and responses.
|
|
22
22
|
- **TypeScript Type Scanning**: Automatically resolve TypeScript types for params, body, and responses based on your API endpoint's TypeScript definitions. Field comments in TypeScript types are reflected as descriptions in the OpenAPI schema.
|
|
23
23
|
- **JSDoc-Based Documentation (Optional)**: Document API routes with JSDoc comments, including tags like `@openapi`, `@auth`, `@desc`, `@params`, `@body`, and `@response` to easily define route metadata.
|
|
24
|
-
- **UI Interface Options**: Choose between Swagger UI
|
|
24
|
+
- **UI Interface Options**: Choose between `Swagger UI`, `Redoc`, `Stoplight Elements` or `RapiDoc` to visualize your API documentation. Customize the interface to fit your preferences.
|
|
25
25
|
- **Real-time Documentation**: As your API evolves, regenerate the OpenAPI documentation with a single command, ensuring your documentation is always up to date.
|
|
26
26
|
- **Easy configuration**: Customize generator behavior using the `next.openapi.json` configuration file, allowing for quick adjustments without modifying the code.
|
|
27
27
|
|
|
@@ -42,8 +42,8 @@ npx next-openapi-gen init --ui swagger --docs-url api-docs
|
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Parameters:
|
|
45
|
-
- ui
|
|
46
|
-
- docs-url
|
|
45
|
+
- **ui**: `swagger` | `redoc` | `stoplight` | `rapidoc`
|
|
46
|
+
- **docs-url**: url on which api docs will be visible
|
|
47
47
|
|
|
48
48
|
This command does the following:
|
|
49
49
|
|
package/dist/commands/init.js
CHANGED
|
@@ -61,10 +61,9 @@ function getDocsPageDependencies(ui) {
|
|
|
61
61
|
}
|
|
62
62
|
return deps.join(" ");
|
|
63
63
|
}
|
|
64
|
-
async function createDocsPage() {
|
|
64
|
+
async function createDocsPage(ui, outputFile) {
|
|
65
65
|
const paths = ["app", "api-docs"];
|
|
66
66
|
const srcPath = path.join(process.cwd(), "src");
|
|
67
|
-
const { ui, outputFile } = openapiTemplate;
|
|
68
67
|
if (fs.existsSync(srcPath)) {
|
|
69
68
|
paths.unshift("src");
|
|
70
69
|
}
|
|
@@ -96,7 +95,7 @@ export async function init(options) {
|
|
|
96
95
|
extendOpenApiTemplate(template, { docsUrl, ui });
|
|
97
96
|
await fse.writeJson(outputPath, template, { spaces: 2 });
|
|
98
97
|
spinner.succeed(`Created OpenAPI template in next.openapi.json`);
|
|
99
|
-
createDocsPage();
|
|
98
|
+
createDocsPage(ui, template.outputFile);
|
|
100
99
|
installDependencies(ui);
|
|
101
100
|
}
|
|
102
101
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-openapi-gen",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Super fast and easy way to generate OpenAPI documentation automatically from API routes in a NextJS 14
|
|
3
|
+
"version": "0.0.14",
|
|
4
|
+
"description": "Super fast and easy way to generate OpenAPI documentation automatically from API routes in a NextJS 14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.mjs",
|