mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 20:47:44 +00:00
Refactored total change counts
Design is more uniformed and standardized, patterns are bubbling up. I think we're ready to tackle the schema soon. Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
@@ -16,9 +16,9 @@ type ExternalDocChanges struct {
|
||||
|
||||
// TotalChanges returns a count of everything that changed
|
||||
func (e *ExternalDocChanges) TotalChanges() int {
|
||||
c := len(e.Changes)
|
||||
c := e.PropertyChanges.TotalChanges()
|
||||
if e.ExtensionChanges != nil {
|
||||
c += len(e.ExtensionChanges.Changes)
|
||||
c += e.ExtensionChanges.TotalChanges()
|
||||
}
|
||||
return c
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func CompareExternalDocs(l, r *base.ExternalDoc) *ExternalDocChanges {
|
||||
|
||||
// check extensions
|
||||
dc.ExtensionChanges = CheckExtensions(l, r)
|
||||
if len(dc.Changes) <= 0 && dc.ExtensionChanges == nil {
|
||||
if dc.TotalChanges() <= 0 {
|
||||
return nil
|
||||
}
|
||||
return dc
|
||||
|
||||
Reference in New Issue
Block a user