From 9edca2a0e7f40aedcc9771b7e6fa0bc5bff4dee9 Mon Sep 17 00:00:00 2001 From: qazsato Date: Mon, 25 Nov 2024 10:23:24 +0900 Subject: [PATCH 1/2] add keywords --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 31b4655..1db2d26 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ }, "keywords": [ "OpenAPI", - "Stoplight" + "Stoplight", + "Swagger", + "Redoc" ], "author": "qazsato ", "license": "MIT", From e0513d41a1ca0ed407ac2ee06ac0dcfa6a5f0102 Mon Sep 17 00:00:00 2001 From: qazsato Date: Mon, 25 Nov 2024 10:30:47 +0900 Subject: [PATCH 2/2] add description option --- README.md | 1 + resources/redoc/template.ejs | 1 + resources/stoplight/template.ejs | 1 + resources/swagger/template.ejs | 1 + src/index.js | 8 ++++---- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b547d0e..6db751d 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ npx openapi-generate-html -i openapi.json --theme=dark | --ui | "stoplight" | Choose UI (stoplight / swagger / redoc) | | --theme | "light" | Choose Theme (light / dark) | | --title | "OpenAPI Docs" | Title of the HTML page | +| --description | | Description of the HTML page | ## UI Pattern diff --git a/resources/redoc/template.ejs b/resources/redoc/template.ejs index 39db6bb..8b87ea7 100644 --- a/resources/redoc/template.ejs +++ b/resources/redoc/template.ejs @@ -4,6 +4,7 @@ <%= title %> + diff --git a/resources/stoplight/template.ejs b/resources/stoplight/template.ejs index 9cb9a75..ca18362 100644 --- a/resources/stoplight/template.ejs +++ b/resources/stoplight/template.ejs @@ -4,6 +4,7 @@ <%= title %> + diff --git a/resources/swagger/template.ejs b/resources/swagger/template.ejs index 810d2a3..a576bca 100644 --- a/resources/swagger/template.ejs +++ b/resources/swagger/template.ejs @@ -4,6 +4,7 @@ <%= title %> + diff --git a/src/index.js b/src/index.js index ad27bbd..0ae501b 100755 --- a/src/index.js +++ b/src/index.js @@ -52,6 +52,7 @@ function getCliOptions() { ) .option('--ui ', `Choose UI (${UI.join(', ')})`, validateCommandUi) .option('--title ', 'Title of the HTML page', 'OpenAPI Docs') + .option('--description <description>', 'Description of the HTML page', '') .option( '--theme <theme>', 'Theme of the HTML page. Choose from light or dark.', @@ -92,8 +93,6 @@ async function askQuestions(options) { async function renderOpenApiHtml(result) { const ui = result.ui - const theme = result.theme - const title = result.title const template = fs.readFileSync( path.resolve(__dirname, `../resources/${ui}/template.ejs`), @@ -132,8 +131,9 @@ async function renderOpenApiHtml(result) { const apiDocs = await $RefParser.bundle(rawApiDocs) return ejs.render(template, { - theme, - title, + theme: result.theme, + title: result.title, + description: result.description, jsContent, cssContent, apiDocs: JSON.stringify(apiDocs),