diff --git a/manifest/info.go b/manifest/info.go index de713f589..46682e0fa 100644 --- a/manifest/info.go +++ b/manifest/info.go @@ -9,10 +9,10 @@ import ( ) type ManifestInfo struct { - Name string `json:"name"` - Version string `json:"version"` - Modules []ModulesInfo `json:"modules"` - ProtoFiles []*ProtoFileInfo `json:"proto_files"` + Name string `json:"name"` + Version string `json:"version"` + Modules []ModulesInfo `json:"modules"` + ProtoFiles []ProtoFileInfo `json:"proto_files"` } type ProtoFileInfo struct { @@ -31,7 +31,7 @@ type ModulesInfo struct { OutputType string `json:"output_type"` UpdatePolicy *string `json:"update_policy,omitempty"` InitialBlock uint64 `json:"initial_block"` - Documentation string `json:"documentation"` + Documentation *string `json:"documentation,omitempty"` Hash string `json:"hash"` } @@ -80,11 +80,12 @@ func Info(manifestPath string) (*ManifestInfo, error) { modInfo.UpdatePolicy = strPtr(v.KindStore.UpdatePolicy.Pretty()) default: modInfo.Kind = "unknown" + modInfo.OutputType = "unknown" } modMeta := pkg.ModuleMeta[ix] if modMeta != nil && modMeta.Doc != "" { - modInfo.Documentation = strings.Replace(modMeta.Doc, "\n", "\n ", -1) + modInfo.Documentation = strPtr(strings.Replace(modMeta.Doc, "\n", "\n ", -1)) } inputs := make([]ModuleInput, 0, len(mod.Inputs)) @@ -104,6 +105,9 @@ func Info(manifestPath string) (*ManifestInfo, error) { if v.Store.Mode > 0 { inputInfo.Mode = strPtr(v.Store.Mode.Pretty()) } + default: + inputInfo.Type = "unknown" + inputInfo.Name = "unknown" } inputs = append(inputs, inputInfo) @@ -113,9 +117,9 @@ func Info(manifestPath string) (*ManifestInfo, error) { modules = append(modules, modInfo) } - protoFiles := make([]*ProtoFileInfo, 0, len(pkg.ProtoFiles)) + protoFiles := make([]ProtoFileInfo, 0, len(pkg.ProtoFiles)) for _, protoFile := range pkg.ProtoFiles { - protoFiles = append(protoFiles, &ProtoFileInfo{ + protoFiles = append(protoFiles, ProtoFileInfo{ Name: protoFile.Name, Package: protoFile.Package, Dependencies: protoFile.Dependency,