From 3527ac4a4f9372837c2de0c87b3ab52e7c5b5954 Mon Sep 17 00:00:00 2001 From: Alex Godoroja Date: Wed, 24 Jun 2026 14:10:51 -0700 Subject: [PATCH 1/2] scaffold: add json tags to ChangelogRel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The struct had only yaml tags, so the generated metadata.json emitted Go-cased keys (Version/Date/Notes) instead of version/date/notes — wrong for every app's store-page changelog. Add json tags (date/notes omitempty). Guard test. --- internal/scaffold/changelog_json_test.go | 14 ++++++++++++++ internal/scaffold/config.go | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 internal/scaffold/changelog_json_test.go diff --git a/internal/scaffold/changelog_json_test.go b/internal/scaffold/changelog_json_test.go new file mode 100644 index 0000000..bfc4937 --- /dev/null +++ b/internal/scaffold/changelog_json_test.go @@ -0,0 +1,14 @@ +package scaffold +import ("encoding/json";"strings";"testing") +func TestChangelogJSONLowercase(t *testing.T) { + c := &Config{ID:"io.x.y", Namespace:"y", AppVersion:"0.1.0", Description:"d", + Listing: Listing{Changelog: []ChangelogRel{{Version:"0.1.0", Notes:[]string{"first"}}}}} + b, _ := json.Marshal(BuildMetadata(c)) + s := string(b) + for _, k := range []string{`"version"`, `"notes"`} { + if !strings.Contains(s, k) { t.Errorf("metadata changelog missing lowercase key %s", k) } + } + for _, k := range []string{`"Version"`, `"Notes"`, `"Date"`} { + if strings.Contains(s, k) { t.Errorf("metadata changelog has Go-cased key %s", k) } + } +} diff --git a/internal/scaffold/config.go b/internal/scaffold/config.go index 7581cf8..07cc0c8 100644 --- a/internal/scaffold/config.go +++ b/internal/scaffold/config.go @@ -77,9 +77,9 @@ type Vendor struct { // ChangelogRel is one release's notes for the store page. type ChangelogRel struct { - Version string `yaml:"version"` - Date string `yaml:"date"` - Notes []string `yaml:"notes"` + Version string `json:"version" yaml:"version"` + Date string `json:"date,omitempty" yaml:"date"` + Notes []string `json:"notes,omitempty" yaml:"notes"` } // Publisher carries the path to the ed25519 signing key (generated once via From 64edd459deed36c8b5ec473b43025a5b3f1e2bea Mon Sep 17 00:00:00 2001 From: Alex Godoroja Date: Wed, 24 Jun 2026 14:13:43 -0700 Subject: [PATCH 2/2] gofmt internal/scaffold/changelog_json_test.go --- internal/scaffold/changelog_json_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/internal/scaffold/changelog_json_test.go b/internal/scaffold/changelog_json_test.go index bfc4937..94efb02 100644 --- a/internal/scaffold/changelog_json_test.go +++ b/internal/scaffold/changelog_json_test.go @@ -1,14 +1,24 @@ package scaffold -import ("encoding/json";"strings";"testing") + +import ( + "encoding/json" + "strings" + "testing" +) + func TestChangelogJSONLowercase(t *testing.T) { - c := &Config{ID:"io.x.y", Namespace:"y", AppVersion:"0.1.0", Description:"d", - Listing: Listing{Changelog: []ChangelogRel{{Version:"0.1.0", Notes:[]string{"first"}}}}} + c := &Config{ID: "io.x.y", Namespace: "y", AppVersion: "0.1.0", Description: "d", + Listing: Listing{Changelog: []ChangelogRel{{Version: "0.1.0", Notes: []string{"first"}}}}} b, _ := json.Marshal(BuildMetadata(c)) s := string(b) for _, k := range []string{`"version"`, `"notes"`} { - if !strings.Contains(s, k) { t.Errorf("metadata changelog missing lowercase key %s", k) } + if !strings.Contains(s, k) { + t.Errorf("metadata changelog missing lowercase key %s", k) + } } for _, k := range []string{`"Version"`, `"Notes"`, `"Date"`} { - if strings.Contains(s, k) { t.Errorf("metadata changelog has Go-cased key %s", k) } + if strings.Contains(s, k) { + t.Errorf("metadata changelog has Go-cased key %s", k) + } } }