diff --git a/tools/generator/autorest/model/changelog.go b/tools/generator/autorest/model/changelog.go index 9b02e8834aff..10948c72fa4d 100644 --- a/tools/generator/autorest/model/changelog.go +++ b/tools/generator/autorest/model/changelog.go @@ -57,7 +57,7 @@ func (c Changelog) ToCompactMarkdown() string { // GetBreakingChangeItems returns an array of the breaking change items func (c Changelog) GetBreakingChangeItems() []string { if c.Modified == nil { - return nil + return []string{} } return getBreakingChanges(c.Modified.BreakingChanges) } @@ -155,12 +155,11 @@ func getNewContents(c *delta.Content) []string { } func getBreakingChanges(b *report.BreakingChanges) []string { + items := make([]string, 0) if b == nil || b.IsEmpty() { - return nil + return items } - var items []string - // get signature changes items = append(items, getSignatureChangeItems(b)...) diff --git a/tools/generator/cmd/root.go b/tools/generator/cmd/root.go index 6485f52fa324..51581e782b9c 100644 --- a/tools/generator/cmd/root.go +++ b/tools/generator/cmd/root.go @@ -209,6 +209,7 @@ func (ctx generateContext) generate(input *pipeline.GenerateInput) (*pipeline.Ge log.Printf("Getting package result for package '%s'", p.PackageName) content := p.Changelog.ToCompactMarkdown() breaking := p.Changelog.HasBreakingChanges() + breakingChangeItems := p.Changelog.GetBreakingChangeItems() set.add(pipeline.PackageResult{ Version: version.Number, PackageName: getPackageIdentifier(p.PackageName), @@ -217,7 +218,7 @@ func (ctx generateContext) generate(input *pipeline.GenerateInput) (*pipeline.Ge Changelog: &pipeline.Changelog{ Content: &content, HasBreakingChange: &breaking, - BreakingChangeItems: p.Changelog.GetBreakingChangeItems(), + BreakingChangeItems: &breakingChangeItems, }, }) } diff --git a/tools/generator/pipeline/model.go b/tools/generator/pipeline/model.go index 2f6d44da13eb..577b5aae5c2e 100644 --- a/tools/generator/pipeline/model.go +++ b/tools/generator/pipeline/model.go @@ -85,9 +85,9 @@ type PackageResult struct { // Changelog ... type Changelog struct { - Content *string `json:"content,omitempty"` - HasBreakingChange *bool `json:"hasBreakingChange,omitempty"` - BreakingChangeItems []string `json:"breakingChangeItems,omitempty"` + Content *string `json:"content,omitempty"` + HasBreakingChange *bool `json:"hasBreakingChange,omitempty"` + BreakingChangeItems *[]string `json:"breakingChangeItems,omitempty"` } // InstallInstructionScriptOutput ...