func newTypeResolver(pkg string, doc *spec.Document) *typeResolver { resolver := typeResolver{ModelsPackage: pkg, Doc: doc} resolver.KnownDefs = make(map[string]struct{}, 64) for k, sch := range doc.OrigSpec().Definitions { resolver.KnownDefs[k] = struct{}{} if nm, ok := sch.Extensions["x-go-name"]; ok { resolver.KnownDefs[nm.(string)] = struct{}{} } } return &resolver }