From f6cfb2de1ed8a7b176e94ca7ffc43fa4033e9ecc Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 25 Nov 2021 23:10:54 +0300 Subject: [PATCH] avoid panic on empty swagger info element Signed-off-by: Vasiliy Tolstov --- openapiv3.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openapiv3.go b/openapiv3.go index 20d689c..8deb3e0 100644 --- a/openapiv3.go +++ b/openapiv3.go @@ -87,7 +87,9 @@ func (g *openapiv3Generator) buildDocumentV3(plugin *protogen.Plugin) *v3.Docume if doc.Openapi != "" { d.Openapi = doc.Openapi } - d.Info = proto.Clone(doc.Info).(*v3.Info) + if doc.Info != nil { + d.Info = proto.Clone(doc.Info).(*v3.Info) + } d.Servers = append(d.Servers, doc.Servers...) }