fix: continued moving everything to orderedmaps plus cleaned up most the tests

This commit is contained in:
Tristan Cartledge
2023-12-01 17:37:07 +00:00
parent 0f3d0cb28f
commit a4ad09aab3
169 changed files with 3435 additions and 3764 deletions

View File

@@ -22,13 +22,13 @@ import (
// v3 - https://spec.openapis.org/oas/v3.1.0#discriminator-object
type Discriminator struct {
PropertyName low.NodeReference[string]
Mapping low.NodeReference[orderedmap.Map[low.KeyReference[string], low.ValueReference[string]]]
Mapping low.NodeReference[*orderedmap.Map[low.KeyReference[string], low.ValueReference[string]]]
low.Reference
}
// FindMappingValue will return a ValueReference containing the string mapping value
func (d *Discriminator) FindMappingValue(key string) *low.ValueReference[string] {
for pair := d.Mapping.Value.First(); pair != nil; pair = pair.Next() {
for pair := orderedmap.First(d.Mapping.Value); pair != nil; pair = pair.Next() {
if pair.Key().Value == key {
v := pair.Value()
return &v
@@ -45,7 +45,7 @@ func (d *Discriminator) Hash() [32]byte {
f = append(f, d.PropertyName.Value)
}
for pair := orderedmap.First(d.Mapping.Value); pair != nil; pair = pair.Next() {
for pair := orderedmap.First(orderedmap.SortAlpha(d.Mapping.Value)); pair != nil; pair = pair.Next() {
f = append(f, pair.Value().Value)
}