mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 12:37:48 +00:00
fix: continued moving everything to orderedmaps plus cleaned up most the tests
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user