helpers

package
v0.0.69 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreTypesCompatible added in v0.0.60

func AreTypesCompatible(typeA, typeB string) bool

AreTypesCompatible reports whether two JSON Schema scalar types overlap for path ambiguity purposes.

func CanLiteralMatchType added in v0.0.60

func CanLiteralMatchType(literal, paramType string) bool

CanLiteralMatchType reports whether a literal path segment could be accepted by a path parameter of the supplied JSON Schema type.

func CheckPaths added in v0.0.60

func CheckPaths(pathA, pathB string, paramsA, paramsB map[string]string) bool

CheckPaths reports whether two OpenAPI path templates are ambiguous.

func CompareSegments added in v0.0.60

func CompareSegments(segsA, segsB []Segment) bool

CompareSegments reports whether two parsed path templates are ambiguous.

func ConvertInterfaceMapKeys

func ConvertInterfaceMapKeys(input interface{}) interface{}

ConvertInterfaceMapKeys takes an arbitrary interface{} and converts any map[interface{}]interface{} it finds into map[string]interface{}. It does this recursively, so nested maps and slices are also processed YAML is great and annoying, and JSON encoding gets very upset sometimes.

func DiveIntoValidationError

func DiveIntoValidationError(e *jsonschema.ValidationError, causes *[]string, location string)

DiveIntoValidationError recursively dives into the validation error and collects all the causes, nicely printed and formatted in a string slice

func HashString

func HashString(s string) string

func Intern

func Intern(s string) string

func WrapBackticks

func WrapBackticks(slice []any) string

WrapBackticks wraps each s in backticks and joins with ", ".

func WrapBackticksString

func WrapBackticksString(s []string) string

Types

type Segment added in v0.0.60

type Segment struct {
	Value     string
	IsVar     bool
	ParamName string
	ParamType string
	Operator  string
}

Segment represents one path segment after URI-template parsing.

func ParseSegments added in v0.0.60

func ParseSegments(path string, paramTypes map[string]string) []Segment

ParseSegments parses an OpenAPI path into comparable path segments. paramTypes maps path parameter names to JSON Schema types.

type TemplateSegment added in v0.0.60

type TemplateSegment struct {
	Raw        string
	Operator   string
	Name       string
	Explode    bool
	Prefix     int
	IsVariable bool
}

TemplateSegment represents a parsed RFC 6570 URI template expression.

func ParseTemplateSegment added in v0.0.60

func ParseTemplateSegment(segment string) TemplateSegment

ParseTemplateSegment parses a single URI template segment.

Jump to

Keyboard shortcuts

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