From 291954053724e617f33430e48c70ae71dba40ea3 Mon Sep 17 00:00:00 2001 From: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> Date: Wed, 8 Feb 2023 16:37:12 -0500 Subject: [PATCH] fix swagger transformer --- cmd/transform-swagger/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/transform-swagger/main.go b/cmd/transform-swagger/main.go index b690cc84..d1e63b1d 100644 --- a/cmd/transform-swagger/main.go +++ b/cmd/transform-swagger/main.go @@ -11,6 +11,7 @@ import ( "log" "os" "path/filepath" + "regexp" "strings" "github.com/go-openapi/loads" @@ -137,7 +138,10 @@ func loadSharedDefinitions(sharedPath, svcPath string) (map[string]bool, error) for _, def := range doc.Analyzer.AllDefinitions() { if def.TopLevel { - if !strings.HasPrefix(def.Name, "hashicorp.cloud") { + // depending on which plugin used for swagger, some package info may not be available + // any types missing package information are skipped + fqnSwaggerFormat, _ := regexp.MatchString("\\w+\\.\\w+\\.", def.Name) + if fqnSwaggerFormat && !strings.HasPrefix(def.Name, "hashicorp.cloud") { sharedDefs[def.Name] = true } }