chore: update to use iterators on orderedmaps

This commit is contained in:
Tristan Cartledge
2024-08-14 12:10:07 +01:00
committed by quobix
parent c3eb16d4e4
commit 161a41f73b
73 changed files with 690 additions and 550 deletions

View File

@@ -6,7 +6,6 @@ package model
import (
"github.com/pb33f/libopenapi/datamodel/low"
v3 "github.com/pb33f/libopenapi/datamodel/low/v3"
"github.com/pb33f/libopenapi/orderedmap"
)
// CallbackChanges represents all changes made between two Callback OpenAPI objects.
@@ -65,14 +64,14 @@ func CompareCallback(l, r *v3.Callback) *CallbackChanges {
lValues := make(map[string]low.ValueReference[*v3.PathItem])
rValues := make(map[string]low.ValueReference[*v3.PathItem])
for pair := orderedmap.First(l.Expression); pair != nil; pair = pair.Next() {
lHashes[pair.Key().Value] = low.GenerateHashString(pair.Value().Value)
lValues[pair.Key().Value] = pair.Value()
for k, v := range l.Expression.FromOldest() {
lHashes[k.Value] = low.GenerateHashString(v.Value)
lValues[k.Value] = v
}
for pair := orderedmap.First(r.Expression); pair != nil; pair = pair.Next() {
rHashes[pair.Key().Value] = low.GenerateHashString(pair.Value().Value)
rValues[pair.Key().Value] = pair.Value()
for k, v := range r.Expression.FromOldest() {
rHashes[k.Value] = low.GenerateHashString(v.Value)
rValues[k.Value] = v
}
expChanges := make(map[string]*PathItemChanges)