mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 12:37:48 +00:00
Expose Key node on Low schema proxy
This commit is contained in:
@@ -54,10 +54,12 @@ type SchemaProxy struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build will prepare the SchemaProxy for rendering, it does not build the Schema, only sets up internal state.
|
// Build will prepare the SchemaProxy for rendering, it does not build the Schema, only sets up internal state.
|
||||||
func (sp *SchemaProxy) Build(root *yaml.Node, idx *index.SpecIndex) error {
|
// Key maybe nil if absent.
|
||||||
sp.vn = root
|
func (sp *SchemaProxy) Build(key, value *yaml.Node, idx *index.SpecIndex) error {
|
||||||
|
sp.kn = key
|
||||||
|
sp.vn = value
|
||||||
sp.idx = idx
|
sp.idx = idx
|
||||||
if rf, _, r := utils.IsNodeRefValue(root); rf {
|
if rf, _, r := utils.IsNodeRefValue(value); rf {
|
||||||
sp.isReference = true
|
sp.isReference = true
|
||||||
sp.referenceLookup = r
|
sp.referenceLookup = r
|
||||||
}
|
}
|
||||||
@@ -127,6 +129,11 @@ func (sp *SchemaProxy) GetSchemaReference() string {
|
|||||||
return sp.referenceLookup
|
return sp.referenceLookup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetKeyNode will return the yaml.Node pointer that is a key for value node.
|
||||||
|
func (sp *SchemaProxy) GetKeyNode() *yaml.Node {
|
||||||
|
return sp.kn
|
||||||
|
}
|
||||||
|
|
||||||
// GetValueNode will return the yaml.Node pointer used by the proxy to generate the Schema.
|
// GetValueNode will return the yaml.Node pointer used by the proxy to generate the Schema.
|
||||||
func (sp *SchemaProxy) GetValueNode() *yaml.Node {
|
func (sp *SchemaProxy) GetValueNode() *yaml.Node {
|
||||||
return sp.vn
|
return sp.vn
|
||||||
|
|||||||
Reference in New Issue
Block a user