mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 04:20:24 +00:00
Working in generics now to reduce code.
generics are a little funky still. sigh.
This commit is contained in:
@@ -1,15 +1,29 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"github.com/pb33f/libopenapi/datamodel/low"
|
||||
"gopkg.in/yaml.v3"
|
||||
"github.com/pb33f/libopenapi/datamodel/low"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
const (
|
||||
ExamplesLabel = "examples"
|
||||
ExampleLabel = "example"
|
||||
)
|
||||
|
||||
type Example struct {
|
||||
Node *yaml.Node
|
||||
Summary low.NodeReference[string]
|
||||
Description low.NodeReference[string]
|
||||
Value low.ObjectReference
|
||||
ExternalValue low.NodeReference[string]
|
||||
Extensions map[string]low.ObjectReference
|
||||
Summary low.NodeReference[string]
|
||||
Description low.NodeReference[string]
|
||||
Value low.NodeReference[any]
|
||||
ExternalValue low.NodeReference[string]
|
||||
Extensions map[low.KeyReference[string]]low.ValueReference[any]
|
||||
}
|
||||
|
||||
func (ex Example) Build(root *yaml.Node) error {
|
||||
// extract extensions
|
||||
extensionMap, err := ExtractExtensions(root)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ex.Extensions = extensionMap
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user