Documentation ¶
Overview ¶
Package compiler provides support functions to generated compiler code.
Index ¶
- func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string
- func DescribeMap(in interface{}, indent string) string
- func DisableFileCache()
- func DisableInfoCache()
- func FetchFile(fileurl string) ([]byte, error)
- func HandleExtension(context *Context, in interface{}, extensionName string) (bool, *any.Any, error)
- func InvalidKeysInMap(m yaml.MapSlice, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string
- func MapHasKey(m yaml.MapSlice, key string) bool
- func MapValueForKey(m yaml.MapSlice, key string) interface{}
- func MissingKeysInMap(m yaml.MapSlice, requiredKeys []string) []string
- func NewErrorGroupOrNil(errors []error) error
- func PluralProperties(count int) string
- func ReadBytesForFile(filename string) ([]byte, error)
- func ReadInfoForRef(basefile string, ref string) (interface{}, error)
- func ReadInfoFromBytes(filename string, bytes []byte) (interface{}, error)
- func RemoveFromFileCache(fileurl string)
- func RemoveFromInfoCache(filename string)
- func SortedKeysForMap(m yaml.MapSlice) []string
- func StringArrayContainsValue(array []string, value string) bool
- func StringArrayContainsValues(array []string, values []string) bool
- func StringValue(item interface{}) (value string, ok bool)
- func UnpackMap(in interface{}) (yaml.MapSlice, bool)
- type Context
- type Error
- type ErrorGroup
- type ExtensionHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertInterfaceArrayToStringArray ¶
func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string
ConvertInterfaceArrayToStringArray converts an array of interfaces to an array of strings, if possible.
func DescribeMap ¶
DescribeMap describes a map (for debugging purposes).
func DisableFileCache ¶ added in v0.3.0
func DisableFileCache()
func DisableInfoCache ¶ added in v0.3.0
func DisableInfoCache()
func HandleExtension ¶
func HandleExtension(context *Context, in interface{}, extensionName string) (bool, *any.Any, error)
HandleExtension calls a binary extension handler.
func InvalidKeysInMap ¶
func InvalidKeysInMap(m yaml.MapSlice, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string
InvalidKeysInMap returns keys in a map that don't match a list of allowed keys and patterns.
func MapValueForKey ¶
func MapValueForKey(m yaml.MapSlice, key string) interface{}
MapValueForKey gets the value of a map value for a specified key.
func MissingKeysInMap ¶
MissingKeysInMap identifies which keys from a list of required keys are not in a map.
func NewErrorGroupOrNil ¶
NewErrorGroupOrNil returns a new ErrorGroup for a slice of errors or nil if the slice is empty.
func PluralProperties ¶
PluralProperties returns the string "properties" pluralized.
func ReadBytesForFile ¶
ReadBytesForFile reads the bytes of a file.
func ReadInfoForRef ¶
ReadInfoForRef reads a file and return the fragment needed to resolve a $ref.
func ReadInfoFromBytes ¶
ReadInfoFromBytes unmarshals a file as a yaml.MapSlice.
func RemoveFromFileCache ¶ added in v0.3.0
func RemoveFromFileCache(fileurl string)
func RemoveFromInfoCache ¶ added in v0.3.0
func RemoveFromInfoCache(filename string)
func SortedKeysForMap ¶
func SortedKeysForMap(m yaml.MapSlice) []string
SortedKeysForMap returns the sorted keys of a yaml.MapSlice.
func StringArrayContainsValue ¶
StringArrayContainsValue returns true if a string array contains a specified value.
func StringArrayContainsValues ¶
StringArrayContainsValues returns true if a string array contains all of a list of specified values.
func StringValue ¶
StringValue returns the string value of an item.
Types ¶
type Context ¶
type Context struct { Parent *Context Name string ExtensionHandlers *[]ExtensionHandler }
Context contains state of the compiler as it traverses a document.
func NewContext ¶
NewContext returns a new object representing the compiler state
func NewContextWithExtensions ¶
func NewContextWithExtensions(name string, parent *Context, extensionHandlers *[]ExtensionHandler) *Context
NewContextWithExtensions returns a new object representing the compiler state
func (*Context) Description ¶
Description returns a text description of the compiler state
type ErrorGroup ¶
type ErrorGroup struct {
Errors []error
}
ErrorGroup is a container for groups of Error values.
func (*ErrorGroup) Error ¶
func (group *ErrorGroup) Error() string
type ExtensionHandler ¶
type ExtensionHandler struct {
Name string
}
ExtensionHandler describes a binary that is called by the compiler to handle specification extensions.