mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 12:37:49 +00:00
Couple of small fixes for what-changed.
No breaking changes, errors and model are returned now (allows errors and model through). And a small fix to the paths hashing mechanism to ensure identical paths with different names are checked.
This commit is contained in:
@@ -153,7 +153,7 @@ func (p *Paths) Hash() [32]byte {
|
||||
}
|
||||
sort.Strings(l)
|
||||
for k := range l {
|
||||
f = append(f, low.GenerateHashString(keys[l[k]].Value))
|
||||
f = append(f, fmt.Sprintf("%s-%s",l[k], low.GenerateHashString(keys[l[k]].Value)))
|
||||
}
|
||||
ekeys := make([]string, len(p.Extensions))
|
||||
z = 0
|
||||
|
||||
10
document.go
10
document.go
@@ -182,10 +182,7 @@ func CompareDocuments(original, updated Document) (*model.DocumentChanges, []err
|
||||
if len(errs) > 0 {
|
||||
errors = errs
|
||||
}
|
||||
if len(errors) > 0 {
|
||||
return nil, errors
|
||||
}
|
||||
return what_changed.CompareOpenAPIDocuments(v3ModelLeft.Model.GoLow(), v3ModelRight.Model.GoLow()), nil
|
||||
return what_changed.CompareOpenAPIDocuments(v3ModelLeft.Model.GoLow(), v3ModelRight.Model.GoLow()), errors
|
||||
}
|
||||
if original.GetSpecInfo().SpecType == utils.OpenApi2 && updated.GetSpecInfo().SpecType == utils.OpenApi2 {
|
||||
v2ModelLeft, errs := original.BuildV2Model()
|
||||
@@ -196,10 +193,7 @@ func CompareDocuments(original, updated Document) (*model.DocumentChanges, []err
|
||||
if len(errs) > 0 {
|
||||
errors = errs
|
||||
}
|
||||
if len(errors) > 0 {
|
||||
return nil, errors
|
||||
}
|
||||
return what_changed.CompareSwaggerDocuments(v2ModelLeft.Model.GoLow(), v2ModelRight.Model.GoLow()), nil
|
||||
return what_changed.CompareSwaggerDocuments(v2ModelLeft.Model.GoLow(), v2ModelRight.Model.GoLow()), errors
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user