utils

package
v0.1.0-beta.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEntryToOASYAML

func AddEntryToOASYAML(oas *yaml.Node, key string, value any, defaultVal *yaml.Node) (*yaml.Node, error)

func ApplyOASOverlay

func ApplyOASOverlay(overlayNode *yaml.Node, specNode *yaml.Node, overlayFile string, specFile string) (*yaml.Node, error)

func ApplyOASOverlayAction

func ApplyOASOverlayAction(action *yaml.Node, specNode *yaml.Node, overlayFile string, specFile string) (*yaml.Node, error)

func CopyFile

func CopyFile(dest string, src string) error

func GetDocMapRoot

func GetDocMapRoot(yamlNode *yaml.Node) *yaml.Node

func GetFieldOrCreateNew

func GetFieldOrCreateNew(node *yaml.Node, key string, value *yaml.Node) *yaml.Node

func JSONFile2YAMLFile

func JSONFile2YAMLFile(input string, output string) error

func JSONPointer2JSONPath

func JSONPointer2JSONPath(jsonPointer string) (jsonPath string, err error)

func JSONText2YAMLText

func JSONText2YAMLText(reader io.Reader) ([]byte, error)

func LocateRef

func LocateRef(refFileNode *yaml.Node, refJSONPath string, jsonRef string) (*yaml.Node, error)

func MakeCyclicRefPlaceholder

func MakeCyclicRefPlaceholder(refJSONPath string) *yaml.Node

func Must

func Must(err error)

func MustClose

func MustClose(c io.Closer)

func MustReadFileBytes

func MustReadFileBytes(path string) []byte

func NewCyclicJSONRefError

func NewCyclicJSONRefError(paths []string) error

func NewMapNode

func NewMapNode() *yaml.Node

func NewRefNode

func NewRefNode(refJSONPath string) *yaml.Node

func NewStringNode

func NewStringNode(value string, style yaml.Style) *yaml.Node

func OAS2FileToOAS3File

func OAS2FileToOAS3File(input string, output string, allowCycles bool) error

func OAS2YAMLtoOAS3YAML

func OAS2YAMLtoOAS3YAML(oasNode *yaml.Node) (*yaml.Node, error)

func OAS3ToYAML

func OAS3ToYAML(doc *openapi3.T) (*yaml.Node, error)

func OASOverlay

func OASOverlay(overlayFile string, specFile string, outputFile string) error

func PushDir

func PushDir(dir string) func()

func ReadInputText

func ReadInputText(input string) ([]byte, error)

func ReadInputTextFile

func ReadInputTextFile(input string) ([]byte, error)

func RemoveExtensions

func RemoveExtensions(input string, output string) error

func RemoveOASExtensions

func RemoveOASExtensions(root *yaml.Node) (*yaml.Node, error)

func RemoveOASExtensionsRecursive

func RemoveOASExtensionsRecursive(node *yaml.Node, parentField string) (*yaml.Node, error)

func RemoveYAMLComments

func RemoveYAMLComments(data []byte) []byte

func RequireBundleZipEquals

func RequireBundleZipEquals(t *testing.T, expectedBundleZip string, actualBundleZip string)

func ResolveDollarRefs

func ResolveDollarRefs(input string, output string, allowCycles bool) error

func SplitJSONRef

func SplitJSONRef(refStr string) (location string, jsonPath string, err error)

func Struct2XMLDocText

func Struct2XMLDocText(p any) ([]byte, error)

func Text2XML

func Text2XML(reader io.Reader) (*etree.Document, error)

func Text2YAML

func Text2YAML(reader io.Reader) (*yaml.Node, error)

func ToV3

func ToV3(doc2 *openapi2.T) (*openapi3.T, error)

func UnFlowYAMLNode

func UnFlowYAMLNode(node *yaml.Node) *yaml.Node

func WriteOutputText

func WriteOutputText(output string, outputText []byte) error

func XML2Text

func XML2Text(doc *etree.Document) ([]byte, error)

func XML2YAML

func XML2YAML(doc *etree.Document) (*yaml.Node, error)

func XML2YAMLRecursive

func XML2YAMLRecursive(ele *etree.Element) (key *yaml.Node, value *yaml.Node, err error)

func XML2YAMLText

func XML2YAMLText(doc *etree.Document, indent int) ([]byte, error)

func XMLFile2YAMLFile

func XMLFile2YAMLFile(input string, output string) error

func XMLText2XML

func XMLText2XML(reader io.Reader) (*etree.Document, error)

func XMLText2YAML

func XMLText2YAML(reader io.Reader) (*yaml.Node, error)

func XMLText2YAMLText

func XMLText2YAMLText(reader io.Reader) ([]byte, error)

func XMLTextFormat

func XMLTextFormat(reader io.Reader) ([]byte, error)

func YAML2Text

func YAML2Text(node *yaml.Node, indent int) ([]byte, error)

func YAML2XML

func YAML2XML(node *yaml.Node) (*etree.Document, error)

func YAML2XMLRecursive

func YAML2XMLRecursive(node *yaml.Node, parent *etree.Element) (*etree.Element, error)

func YAML2XMLText

func YAML2XMLText(node *yaml.Node) ([]byte, error)

func YAMLDetectRefCycles

func YAMLDetectRefCycles(root *yaml.Node, filePath string) (cycles [][]string, err error)

func YAMLDetectRefCyclesRecursive

func YAMLDetectRefCyclesRecursive(node *yaml.Node, relParentPath string, parentFile string, activePaths []string, loaded *map[string]*yaml.Node, cycles *[][]string) error

func YAMLDoc2File

func YAMLDoc2File(docNode *yaml.Node, outputFile string) error

func YAMLFile2JSONFile

func YAMLFile2JSONFile(input string, output string) error

func YAMLFile2XMLFile

func YAMLFile2XMLFile(input string, output string) error

func YAMLFile2YAML

func YAMLFile2YAML(filePath string) (*yaml.Node, error)

func YAMLResolveRefs

func YAMLResolveRefs(root *yaml.Node, filePath string, allowCycles bool) (*yaml.Node, error)

func YAMLResolveRefsRecursive

func YAMLResolveRefsRecursive(node *yaml.Node, relParentPath string, parentFile string, activePaths []string, loaded *map[string]*yaml.Node, cycles *[][]string) (*yaml.Node, error)

func YAMLText2JSONText

func YAMLText2JSONText(reader io.Reader) ([]byte, error)

func YAMLText2XML

func YAMLText2XML(reader io.Reader) (*etree.Document, error)

func YAMLText2XMLText

func YAMLText2XMLText(reader io.Reader) ([]byte, error)

Types

type CyclicJSONRefError

type CyclicJSONRefError struct {
	Paths []string
}

func (CyclicJSONRefError) Error

func (e CyclicJSONRefError) Error() string

type MultiError

type MultiError struct {
	Errors []error
}

func (MultiError) Error

func (e MultiError) Error() string

type StdoutCapture

type StdoutCapture struct {
	// contains filtered or unexported fields
}

func NewStdoutCapture

func NewStdoutCapture() (*StdoutCapture, error)

func (*StdoutCapture) Read

func (sf *StdoutCapture) Read() ([]byte, error)

func (*StdoutCapture) Restore

func (sf *StdoutCapture) Restore()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL