diff --git a/info/info.go b/info/info.go index 0761337e8..7da742841 100644 --- a/info/info.go +++ b/info/info.go @@ -11,11 +11,11 @@ import ( ) type BasicInfo struct { - Name string `json:"name"` - Version string `json:"version"` - Documentation *string `json:"documentation,omitempty"` - Modules []ModulesInfo `json:"modules"` - ProtoFiles []ProtoFileInfo `json:"proto_files"` + Name string `json:"name"` + Version string `json:"version"` + Documentation *string `json:"documentation,omitempty"` + Modules []ModulesInfo `json:"modules"` + ProtoPackages []string `json:"proto_packages"` } type ExtendedInfo struct { @@ -133,20 +133,21 @@ func Basic(manifestPath string) (*BasicInfo, error) { modules = append(modules, modInfo) } + manifestInfo.Modules = modules - protoFiles := make([]ProtoFileInfo, 0, len(pkg.ProtoFiles)) + protoPackages := make([]string, 0, len(pkg.ProtoFiles)) + protoPackageMap := make(map[string]struct{}) for _, protoFile := range pkg.ProtoFiles { - protoFiles = append(protoFiles, ProtoFileInfo{ - Name: protoFile.Name, - Package: protoFile.Package, - Dependencies: protoFile.Dependency, - PublicDependencies: protoFile.PublicDependency, - MessageType: protoFile.MessageType, - }) + if _, ok := protoPackageMap[protoFile.GetPackage()]; ok { + continue + } else { + protoPackageMap[protoFile.GetPackage()] = struct{}{} + } + + protoPackages = append(protoPackages, protoFile.GetPackage()) } - manifestInfo.Modules = modules - manifestInfo.ProtoFiles = protoFiles + manifestInfo.ProtoPackages = protoPackages return manifestInfo, nil }