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 XMLChanges struct {
|
||||
|
||||
// TotalChanges returns a count of everything that was changed within an XML object.
|
||||
func (x *XMLChanges) TotalChanges() int {
|
||||
c := len(x.Changes)
|
||||
c := x.PropertyChanges.TotalChanges()
|
||||
if x.ExtensionChanges != nil {
|
||||
c += len(x.ExtensionChanges.Changes)
|
||||
c += x.ExtensionChanges.TotalChanges()
|
||||
}
|
||||
return c
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func CompareXML(l, r *base.XML) *XMLChanges {
|
||||
// check extensions
|
||||
xc.ExtensionChanges = CheckExtensions(l, r)
|
||||
xc.Changes = changes
|
||||
if len(xc.Changes) <= 0 && xc.ExtensionChanges == nil {
|
||||
if xc.TotalChanges() <= 0 {
|
||||
return nil
|
||||
}
|
||||
return xc
|
||||
|
||||
Reference in New Issue
Block a user