mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-08 20:47:43 +00:00
fix: continued moving everything to orderedmaps plus cleaned up most the tests
This commit is contained in:
@@ -6,13 +6,14 @@ package v2
|
||||
import (
|
||||
low "github.com/pb33f/libopenapi/datamodel/low/v2"
|
||||
"github.com/pb33f/libopenapi/orderedmap"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// Example represents a high-level Swagger / OpenAPI 2 Example object, backed by a low level one.
|
||||
// Allows sharing examples for operation responses
|
||||
// - https://swagger.io/specification/v2/#exampleObject
|
||||
type Example struct {
|
||||
Values orderedmap.Map[string, any]
|
||||
Values *orderedmap.Map[string, *yaml.Node]
|
||||
low *low.Examples
|
||||
}
|
||||
|
||||
@@ -21,7 +22,7 @@ func NewExample(examples *low.Examples) *Example {
|
||||
e := new(Example)
|
||||
e.low = examples
|
||||
if orderedmap.Len(examples.Values) > 0 {
|
||||
values := orderedmap.New[string, any]()
|
||||
values := orderedmap.New[string, *yaml.Node]()
|
||||
for pair := orderedmap.First(examples.Values); pair != nil; pair = pair.Next() {
|
||||
values.Set(pair.Key().Value, pair.Value().Value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user