From f1c4224c4b1ae4dc0bb8c9bdf8177e1d32a82b38 Mon Sep 17 00:00:00 2001 From: quobix Date: Thu, 8 Aug 2024 09:09:27 -0400 Subject: [PATCH] Addressed issue #132 Circular references are no reason to fail running wiretap. Warnings are printed if there are errors, but the model is loaded. --- cmd/root_command.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/root_command.go b/cmd/root_command.go index 8f86caa..9a37693 100644 --- a/cmd/root_command.go +++ b/cmd/root_command.go @@ -542,7 +542,17 @@ var ( // build a model var errs []error docModel, errs = doc.BuildV3Model() - if len(errs) > 0 { + if len(errs) > 0 && docModel != nil { + pterm.Warning.Printf("OpenAPI Specification loaded, but there %s %d %s detected...\n", + shared.Pluralize(len(errs), "was", "were"), + len(errs), + shared.Pluralize(len(errs), "issue", "issues")) + for _, e := range errs { + pterm.Warning.Printf("--> %s\n", e.Error()) + } + } + if len(errs) > 0 && docModel == nil { + pterm.Error.Printf("Failed to load / read OpenAPI specification.") return errors.Join(errs...) } }