Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions tools/generator/autorest/model/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)...)

Expand Down
3 changes: 2 additions & 1 deletion tools/generator/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion tools/generator/pipeline/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type PackageResult struct {
type Changelog struct {
Content *string `json:"content,omitempty"`
HasBreakingChange *bool `json:"hasBreakingChange,omitempty"`
BreakingChangeItems []string `json:"breakingChangeItems,omitempty"`
BreakingChangeItems *[]string `json:"breakingChangeItems,omitempty"`
}

// InstallInstructionScriptOutput ...
Expand Down