openapitools

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 13 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 DeduplicateHeaderEnumValues added in v0.4.4

func DeduplicateHeaderEnumValues(values []any) []any

DeduplicateHeaderEnumValues normalizes and deduplicates header enum values. String values are converted to lowercase and deduplicated since HTTP header values are often treated as case-insensitive for routing purposes by Kong Gateway. Empty strings are filtered out with a warning as they are not practical for routing. Non-string values (e.g., integers) are preserved as-is. Returns the normalized and deduplicated slice.

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 RenderServerURLs added in v0.4.2

func RenderServerURLs(servers []*v3.Server) []string

RenderServerURLs renders server URLs after variable substitution and URL normalization (same as parseServerUris + setServerDefaults). This produces canonical URL strings suitable for use as cache keys, ensuring that equivalent server definitions (e.g., "https://api.example.com" vs "https://api.example.com:443") produce the same output.

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