Merge pull request #38 from six2dez/patch-1

Added failsafe check for files with no security definitions
This commit is contained in:
Tony West authored and GitHub committed 2024-11-15 15:48:15 -05:00
commit 2e9da2e810
1 file changed
+7
+7
View File
@@ -23,6 +23,13 @@ var (
func CheckSecDefs(doc3 openapi3.T) (apiInQuery bool, apiKey string, apiKeyName string) {
if doc3.Components == nil || doc3.Components.SecuritySchemes == nil || len(doc3.Components.SecuritySchemes) == 0 {
if !quiet {
log.Warn("No security schemes defined in the OpenAPI specification.")
}
return false, "", ""
}
if outputFormat == "json" && !quiet {
if len(doc3.Components.SecuritySchemes) != 0 {
log.Warnf("The following authentication mechanisms are supported. If necessary, supply these manually when using the JSON output format:\n")