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

@@ -5,11 +5,10 @@ package model
import (
"fmt"
"slices"
"sort"
"sync"
"slices"
"github.com/pb33f/libopenapi/datamodel/low"
"github.com/pb33f/libopenapi/datamodel/low/base"
v3 "github.com/pb33f/libopenapi/datamodel/low/v3"
@@ -466,15 +465,15 @@ func checkMappedSchemaOfASchema(
rEntities := make(map[string]*base.SchemaProxy)
rKeyNodes := make(map[string]*yaml.Node)
for pair := orderedmap.First(lSchema); pair != nil; pair = pair.Next() {
lProps = append(lProps, pair.Key().Value)
lEntities[pair.Key().Value] = pair.Value().Value
lKeyNodes[pair.Key().Value] = pair.Key().KeyNode
for k, v := range lSchema.FromOldest() {
lProps = append(lProps, k.Value)
lEntities[k.Value] = v.Value
lKeyNodes[k.Value] = k.KeyNode
}
for pair := orderedmap.First(rSchema); pair != nil; pair = pair.Next() {
rProps = append(rProps, pair.Key().Value)
rEntities[pair.Key().Value] = pair.Value().Value
rKeyNodes[pair.Key().Value] = pair.Key().KeyNode
for k, v := range rSchema.FromOldest() {
rProps = append(rProps, k.Value)
rEntities[k.Value] = v.Value
rKeyNodes[k.Value] = k.KeyNode
}
sort.Strings(lProps)
sort.Strings(rProps)