-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: quobix <[email protected]>
- Loading branch information
1 parent
cf74572
commit aee63b5
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2023-2024 Princess Beef Heavy Industries, LLC / Dave Shanley | ||
// https://pb33f.io | ||
|
||
package cmd | ||
|
||
import ( | ||
whatChanged "github.com/pb33f/libopenapi/what-changed/model" | ||
"github.com/pb33f/openapi-changes/model" | ||
) | ||
|
||
func FlattenReport(report *model.Report) *model.FlatReport { | ||
|
||
flatReport := &model.FlatReport{} | ||
flatReport.Summary = report.Summary | ||
var changes []*whatChanged.Change | ||
rpt := report.Commit.Changes | ||
for _, change := range rpt.GetAllChanges() { | ||
changes = append(changes, change) | ||
} | ||
flatReport.Changes = changes | ||
return flatReport | ||
} | ||
|
||
func FlattenHistoricalReport(report *model.HistoricalReport) *model.FlatHistoricalReport { | ||
|
||
flatReport := &model.FlatHistoricalReport{} | ||
flatReport.GitRepoPath = report.GitRepoPath | ||
flatReport.GitFilePath = report.GitFilePath | ||
flatReport.DateGenerated = report.DateGenerated | ||
flatReport.Filename = report.Filename | ||
for _, r := range report.Reports { | ||
flatReport.Reports = append(flatReport.Reports, FlattenReport(r)) | ||
} | ||
return flatReport | ||
} |