openapitools

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertYamlNodeToBytes

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

ConvertYamlNodeToBytes will convert a yaml node to bytes.

func CreateKongService

func CreateKongService(
	baseName string,
	servers []*v3.Server,
	serviceDefaults []byte,
	upstreamDefaults []byte,
	tags []string,
	uuidNamespace uuid.UUID,
	skipID bool,
) (map[string]interface{}, map[string]interface{}, error)

CreateKongService creates a new Kong service entity, and optional upstream. `baseName` will be used as the name of the service (slugified), and as input for the UUIDv5 generation.

func CrossProduct

func CrossProduct(slices ...[]any) [][]any

CrossProduct computes the Cartesian product of the input slices. The slices can be of any type

func DereferenceJSONObject

func DereferenceJSONObject(
	value map[string]interface{},
	components *map[string]interface{},
) (map[string]interface{}, error)

DereferenceJSONObject will dereference a JSON object.

func GetRouteDefaults

func GetRouteDefaults(
	extensions *orderedmap.Map[string, *yaml.Node],
	components *map[string]interface{},
) ([]byte, error)

GetRouteDefaults returns a JSON string containing the route defaults

func GetXKongComponents

func GetXKongComponents(doc v3.Document) (*map[string]interface{}, error)

GetXKongComponents returns a map of the '/components/x-kong/' object. If the extension is not there it will return an empty map. If the entry is not a yaml object, it will return an error.

func GetXKongObject

func GetXKongObject(
	extensions *orderedmap.Map[string, *yaml.Node],
	key string, components *map[string]interface{},
) ([]byte, error)

GetXKongObject returns specified 'key' from the extension properties if available. Returns nil if it wasn't found, an error if it wasn't an object or couldn't be dereferenced. The returned object will be json encoded again.

func SanitizeRegexCapture

func SanitizeRegexCapture(varName string, insoCompat bool) string

SanitizeRegexCapture will remove illegal characters from the path-variable name. The returned name will be valid for PCRE regex captures; Alphanumeric + '_', starting with [a-zA-Z].

func Slugify

func Slugify(insoCompat bool, name ...string) string

Slugify converts a name to a valid Kong name by removing and replacing unallowed characters and sanitizing non-latin characters. Multiple inputs will be concatenated using '_'.

func ToKebabCase

func ToKebabCase(s string) string

ToKebabCase converts a string to kebab-case Handles camelCase, PascalCase, snake_case, and existing kebab-case

Types

This section is empty.

Jump to

Keyboard shortcuts

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