mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 20:47:45 +00:00
Time to revisit each model and build individual tests to ensure all error handling is in place across the model. Signed-off-by: Dave Shanley <dave@quobix.com>
41 lines
634 B
Go
41 lines
634 B
Go
package low
|
|
|
|
import "gopkg.in/yaml.v3"
|
|
|
|
type HasNode interface {
|
|
GetNode() *yaml.Node
|
|
}
|
|
|
|
type Buildable[T any] interface {
|
|
Build(node *yaml.Node) error
|
|
*T
|
|
}
|
|
|
|
type NodeReference[T any] struct {
|
|
Value T
|
|
ValueNode *yaml.Node
|
|
KeyNode *yaml.Node
|
|
}
|
|
|
|
type KeyReference[T any] struct {
|
|
Value T
|
|
KeyNode *yaml.Node
|
|
}
|
|
|
|
type ValueReference[T any] struct {
|
|
Value T
|
|
ValueNode *yaml.Node
|
|
}
|
|
|
|
func (n NodeReference[T]) IsEmpty() bool {
|
|
return n.KeyNode == nil && n.ValueNode == nil
|
|
}
|
|
|
|
func (n ValueReference[T]) IsEmpty() bool {
|
|
return n.ValueNode == nil
|
|
}
|
|
|
|
func (n KeyReference[T]) IsEmpty() bool {
|
|
return n.KeyNode == nil
|
|
}
|