Documentation ¶
Index ¶
- Constants
- Variables
- func BuildPath(basePath string, segs []string) string
- func ConvertComponentIdIntoFriendlyPathSearch(id string) (string, string)
- func ConvertComponentIdIntoPath(id string) (string, string)
- func ConvertInterfaceArrayToStringArray(raw interface{}) []string
- func ConvertInterfaceIntoStringMap(context interface{}) map[string]string
- func ConvertInterfaceToStringArray(raw interface{}) []string
- func ConvertYAMLtoJSON(yamlData []byte) ([]byte, error)
- func ExtractValueFromInterfaceMap(name string, raw interface{}) interface{}
- func FindAllKeyNodesWithPath(search *KeyNodeSearch, parent *yaml.Node, searchNodes []*yaml.Node, ...)
- func FindFirstKeyNode(key string, nodes []*yaml.Node, depth int) (keyNode *yaml.Node, valueNode *yaml.Node)
- func FindKeyNode(key string, nodes []*yaml.Node) (keyNode *yaml.Node, valueNode *yaml.Node)
- func FindKeyNodeTop(key string, nodes []*yaml.Node) (keyNode *yaml.Node, valueNode *yaml.Node)
- func FindLastChildNode(node *yaml.Node) *yaml.Node
- func FindNodes(yamlData []byte, jsonPath string) ([]*yaml.Node, error)
- func FindNodesWithoutDeserializing(node *yaml.Node, jsonPath string) ([]*yaml.Node, error)
- func FixContext(context string) string
- func IsHttpVerb(verb string) bool
- func IsJSON(testString string) bool
- func IsNodeArray(node *yaml.Node) bool
- func IsNodeBoolValue(node *yaml.Node) bool
- func IsNodeFloatValue(node *yaml.Node) bool
- func IsNodeIntValue(node *yaml.Node) bool
- func IsNodeMap(node *yaml.Node) bool
- func IsNodePolyMorphic(node *yaml.Node) bool
- func IsNodeStringValue(node *yaml.Node) bool
- func IsYAML(testString string) bool
- func MakeTagReadable(node *yaml.Node) string
- func RenderCodeSnippet(startNode *yaml.Node, specData []string, before, after int) string
- type KeyNodeResult
- type KeyNodeSearch
Constants ¶
const ( // OpenApi3 is used by all OpenAPI 3+ docs OpenApi3 = "openapi" // OpenApi2 is used by all OpenAPI 2 docs, formerly known as swagger. OpenApi2 = "swagger" // AsyncApi is used by akk AsyncAPI docs, all versions. AsyncApi = "asyncapi" )
Variables ¶
var ArrayLabel = "array"
var BinaryLabel = "binary"
var BooleanLabel = "boolean"
var IntegerLabel = "integer"
var NumberLabel = "number"
var ObjectLabel = "object"
var SchemaId = "https://quobix.com/api/vacuum"
var SchemaSource = "https://json-schema.org/draft/2020-12/schema"
var StringLabel = "string"
Functions ¶
func ConvertInterfaceArrayToStringArray ¶
func ConvertInterfaceArrayToStringArray(raw interface{}) []string
ConvertInterfaceArrayToStringArray will convert an unknown interface array type, into a string slice
func ConvertInterfaceIntoStringMap ¶
ConvertInterfaceIntoStringMap will convert an unknown input into a string map.
func ConvertInterfaceToStringArray ¶
func ConvertInterfaceToStringArray(raw interface{}) []string
ConvertInterfaceToStringArray will convert an unknown input map type into a string array/slice
func ConvertYAMLtoJSON ¶
TODO: Deprecate this and use imported library, this is more complex than it seems. ConvertYAMLtoJSON will do exactly what you think it will. It will deserialize YAML into serialized JSON.
func ExtractValueFromInterfaceMap ¶
func ExtractValueFromInterfaceMap(name string, raw interface{}) interface{}
ExtractValueFromInterfaceMap pulls out an unknown value from a map using a string key
func FindAllKeyNodesWithPath ¶
func FindAllKeyNodesWithPath(search *KeyNodeSearch, parent *yaml.Node, searchNodes []*yaml.Node, foundPath []yaml.Node, depth int)
FindAllKeyNodesWithPath This function will search for a key node recursively. Once it finds the node, it will then update the KeyNodeSearch struct
func FindFirstKeyNode ¶
func FindFirstKeyNode(key string, nodes []*yaml.Node, depth int) (keyNode *yaml.Node, valueNode *yaml.Node)
FindFirstKeyNode will locate the first key and value yaml.Node based on a key.
func FindKeyNode ¶
func FindKeyNode(key string, nodes []*yaml.Node) (keyNode *yaml.Node, valueNode *yaml.Node)
FindKeyNode is a non-recursive search of a *yaml.Node Content for a child node with a key. Returns the key and value
func FindKeyNodeTop ¶
func FindKeyNodeTop(key string, nodes []*yaml.Node) (keyNode *yaml.Node, valueNode *yaml.Node)
FindKeyNodeTop is a non-recursive search of top level nodes for a key, will not look at content. Returns the key and value
func FindLastChildNode ¶
func FindLastChildNode(node *yaml.Node) *yaml.Node
func FindNodesWithoutDeserializing ¶
FindNodesWithoutDeserializing will find a node based on JSONPath, without deserializing from yaml/json
func FixContext ¶
FixContext will clean up a JSONpath string to be correctly traversable.
func IsHttpVerb ¶
IsHttpVerb will check if an operation is valid or not.
func IsNodeArray ¶
func IsNodeArray(node *yaml.Node) bool
IsNodeArray checks if a node is an array type
func IsNodeBoolValue ¶
func IsNodeBoolValue(node *yaml.Node) bool
IsNodeBoolValue will check is a node is a bool
func IsNodeFloatValue ¶
func IsNodeFloatValue(node *yaml.Node) bool
IsNodeFloatValue will check is a node is a float value.
func IsNodeIntValue ¶
func IsNodeIntValue(node *yaml.Node) bool
IsNodeIntValue will check if a node is an int value
func IsNodePolyMorphic ¶
func IsNodePolyMorphic(node *yaml.Node) bool
IsNodePolyMorphic will return true if the node contains polymorphic keys.
func IsNodeStringValue ¶
func IsNodeStringValue(node *yaml.Node) bool
IsNodeStringValue checks if a node is a string value
func MakeTagReadable ¶
func MakeTagReadable(node *yaml.Node) string
func RenderCodeSnippet ¶ added in v0.0.4
Types ¶
type KeyNodeResult ¶
type KeyNodeResult struct { KeyNode *yaml.Node ValueNode *yaml.Node Parent *yaml.Node Path []yaml.Node }
KeyNodeResult is a result from a KeyNodeSearch performed by the FindAllKeyNodesWithPath
type KeyNodeSearch ¶
type KeyNodeSearch struct { Key string Ignore []string Results []*KeyNodeResult AllowExtensions bool }
KeyNodeSearch keeps a track of everything we have found on our adventure down the trees.