next-openapi-gen 0.6.8 → 0.6.9
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/commands/init.js +3 -3
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -92,15 +92,15 @@ async function installDependencies(ui) {
|
|
|
92
92
|
function extendOpenApiTemplate(spec, options) {
|
|
93
93
|
spec.ui = options.ui ?? spec.ui;
|
|
94
94
|
spec.docsUrl = options.docsUrl ?? spec.docsUrl;
|
|
95
|
-
spec.schemaType = options.
|
|
95
|
+
spec.schemaType = options.schema ?? spec.schemaType;
|
|
96
96
|
}
|
|
97
97
|
export async function init(options) {
|
|
98
|
-
const { ui
|
|
98
|
+
const { ui } = options;
|
|
99
99
|
spinner.start();
|
|
100
100
|
try {
|
|
101
101
|
const outputPath = path.join(process.cwd(), "next.openapi.json");
|
|
102
102
|
const template = { ...openapiTemplate };
|
|
103
|
-
extendOpenApiTemplate(template,
|
|
103
|
+
extendOpenApiTemplate(template, options);
|
|
104
104
|
await fse.writeJson(outputPath, template, { spaces: 2 });
|
|
105
105
|
spinner.succeed(`Created OpenAPI template in next.openapi.json`);
|
|
106
106
|
createDocsPage(ui, template.outputFile);
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,9 @@ program
|
|
|
13
13
|
.choices(["scalar", "swagger", "redoc", "stoplight", "rapidoc"])
|
|
14
14
|
.default("swagger"))
|
|
15
15
|
.option("-u, --docs-url <url>", "Specify the docs URL", "api-docs")
|
|
16
|
-
.
|
|
16
|
+
.addOption(new Option("-s, --schema <schemaType>", "Specify the schema tool")
|
|
17
|
+
.choices(["zod", "typescript"])
|
|
18
|
+
.default("zod"))
|
|
17
19
|
.description("Initialize a openapi specification")
|
|
18
20
|
.action(init);
|
|
19
21
|
program
|
package/package.json
CHANGED