From f17e5d91dab8298f7bf368ca55abf586c1bda107 Mon Sep 17 00:00:00 2001 From: ktsuench Date: Mon, 16 Dec 2019 11:36:38 -0500 Subject: [PATCH 1/2] add in excludeAuth option --- templates/openapi3/operation.dot | 4 +++- widdershins.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/openapi3/operation.dot b/templates/openapi3/operation.dot index 2c85fbe7..b82df713 100644 --- a/templates/openapi3/operation.dot +++ b/templates/openapi3/operation.dot @@ -45,10 +45,12 @@ {{#def.callbacks}} +{{? !data.options.excludeAuth}} {{ data.security = data.operation.security ? data.operation.security : data.api.security; }} -{{? data.security && data.security.length }} +{{? data.security && data.security.length}} {{#def.authentication}} {{??}} {{#def.authentication_none}} {{?}} +{{?}} {{= data.tags.endSection }} diff --git a/widdershins.js b/widdershins.js index 53907fc5..bc78793f 100755 --- a/widdershins.js +++ b/widdershins.js @@ -30,6 +30,9 @@ var argv = require('yargs') .string('environment') .alias('e','environment') .describe('environment','File to load config options from.') + .boolean('excludeAuth') + .default('excludeAuth',false) + .describe('excludeAuth','Excludes the auth requirement snippets at the end of each operation section.') .boolean('expandBody') .describe('expandBody','Expand the schema and show all properties in the request body.') .number('headings') @@ -166,6 +169,7 @@ options.customApiKeyValue = argv.customApiKeyValue; options.html = argv.html; options.respec = argv.respec; options.useBodyName = argv.useBodyName; +options.excludeAuth = argv.excludeAuth; if (argv.search === false) options.search = false; if (argv.includes) options.includes = argv.includes.split(','); if (argv.respec) { From f20d91243fdd94b87ed5272775e67dcf5f3b919f Mon Sep 17 00:00:00 2001 From: ktsuench Date: Mon, 16 Dec 2019 11:37:37 -0500 Subject: [PATCH 2/2] updated README with new excludeAuth option --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 596e7e5e..9b452eb6 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ node widdershins --search false --language_tabs 'ruby:Ruby' 'python:Python' --su | -u, --user_templates | options.user_templates | `string` | None | Directory to load override templates from. | | -x, --experimental | options.experimental | `boolean` | | For backwards compatibility only; ignored. | | -y, --yaml | options.yaml | `boolean` | `false` | Display JSON schemas in YAML format. | +| | options.excludeAuth | `boolean` | `false` | Excludes the auth requirement snippets at the end of each operation section. | | | options.templateCallback | `function` | None | A `function` that is called before and after each template (JavaScript code only). | | | options.toc_footers | `object` | A map of `url`s and `description`s to be added to the ToC footers array (JavaScript code only). |