Documentation
¶
Index ¶
- Variables
- func AppendOrSetString(destStr *string, srcStr, prefix, separator string)
- func CapitalizeAfterChars(input string, chars []int32, capitalizeFirst bool) string
- func CommentMultiLine(comment string, prefix string) string
- func CommentSingleLine(comment string) string
- func ContentTypeToShortName(input string) string
- func CopyFile(src, dst string) error
- func CountExcluding[S ~[]E, E comparable](s S, exclude ...E) int
- func DetectJSONOrYAML(input []byte) (format string)
- func DownloadBytes(url string) ([]byte, error)
- func Ellipsize(s string, maxLength int) string
- func FindCommonStrPrefix(values []string) string
- func FindHighestVersion(versions []string) string
- func FirstNonEmptyString(values ...string) string
- func GetMapBool(config map[string]interface{}, key string, defaultValue bool) bool
- func GetMapMap(config map[string]interface{}, key string) map[string]interface{}
- func GetMapSliceString(config map[string]interface{}, key string, defaultSlice []string) []string
- func GetMapString(config map[string]interface{}, key string, defaultValue string) string
- func JSONToYAML(jsonData []byte) ([]byte, error)
- func LowerCaseFirstLetter(input string) string
- func MergeComponentMap[V any](destMap, srcMap *orderedmap.Map[string, V], componentType string)
- func MergeMaps(target, source map[string]interface{})
- func ParseURLAPIVersion(url string) string
- func RenameOrderedMapKeys[V any](m *orderedmap.Map[string, V], transformKey func(string) string) (mapping map[string]string)
- func ResolvePath(path string) string
- func SliceToMapWithKeyFunc[T any, K comparable](items []T, keyFunc func(T) K) map[K]T
- func StripANSI(str string) string
- func Ternary[T any](condition bool, trueValue T, falseValue T) T
- func ToCamelCase(input string) string
- func ToKebabCase(input string) string
- func ToOperationId(method string, url string) string
- func ToPascalCase(input string) string
- func ToSlug(input string) string
- func ToSnakeCase(input string) string
- func ToUpperCamelCase(input string) string
- func ToUpperSnakeCase(input string) string
- func TrimNonASCII(input string) string
- func TrimSpaceEachLine(input string) string
- func URLPathParamAddByPrefix(path string) string
- func URLRemovePathParams(url string) string
- func UpperCaseFirstLetter(input string) string
- func UpperCaseFirstLetterOnly(input string) string
- func UppercaseAcronyms(input string) string
Constants ¶
This section is empty.
Variables ¶
var ( ErrRequestFailed = errors.New("request failed") ErrResponseNotOk = errors.New("response not ok") ErrFailedToCopyBytes = errors.New("failed to copy bytes") )
var ( ErrReadDocumentFromFile = fmt.Errorf("file is missing") ErrOpenDocument = fmt.Errorf("failed to open document") ErrNoFilesSpecified = fmt.Errorf("no files specified") ErrDocumentMerge = fmt.Errorf("failed to merge documents") ErrFailedToPatchDocument = fmt.Errorf("failed to patch document") ErrRenderDocument = fmt.Errorf("failed to render document") ErrGenerateOpenAPIV3Model = fmt.Errorf("failed to generate openapi v3 model") ErrWriteDocumentToFile = fmt.Errorf("failed to write document to file") ErrNoGeneratorWithId = fmt.Errorf("no generator with specified id") ErrWriteDocumentToStdout = fmt.Errorf("failed to write document to stdout") ErrJSONMarshal = fmt.Errorf("failed to marshal into JSON") ErrSwagger2OpenAPI30 = fmt.Errorf("failed to convert API spec from Swagger 2.0 to OpenAPI 3.0") )
Functions ¶
func AppendOrSetString ¶
func CapitalizeAfterChars ¶
CapitalizeAfterChars removes the characters in the chars slice and capitalizes the next character
func CommentMultiLine ¶
func CommentSingleLine ¶
CommentSingleLine returns a single line comment, replacing newlines with spaces
func ContentTypeToShortName ¶
func CountExcluding ¶
func CountExcluding[S ~[]E, E comparable](s S, exclude ...E) int
CountExcluding counts the number of occurrences of elements in a slice, excluding specified values.
func DetectJSONOrYAML ¶
func DownloadBytes ¶
func Ellipsize ¶
Ellipsize truncates a string to the specified maximum length and appends "..." if it was truncated.
func FindCommonStrPrefix ¶
FindCommonStrPrefix returns the common prefix of all provided strings if any
func FindHighestVersion ¶
FindHighestVersion finds the highest semver version in a list of versions
func FirstNonEmptyString ¶
FirstNonEmptyString returns the first non-empty string from the input strings
func GetMapBool ¶
func GetMapSliceString ¶
func GetMapString ¶
func JSONToYAML ¶
JSONToYAML converts JSON data to YAML data
func LowerCaseFirstLetter ¶
LowerCaseFirstLetter lowercases the first letter of the input string
func MergeComponentMap ¶
func MergeComponentMap[V any](destMap, srcMap *orderedmap.Map[string, V], componentType string)
func ParseURLAPIVersion ¶
func RenameOrderedMapKeys ¶
func ResolvePath ¶
ResolvePath turns the path into an absolute path
func SliceToMapWithKeyFunc ¶
func SliceToMapWithKeyFunc[T any, K comparable](items []T, keyFunc func(T) K) map[K]T
func ToCamelCase ¶
func ToKebabCase ¶
func ToOperationId ¶
func ToPascalCase ¶
func ToSnakeCase ¶
func ToUpperCamelCase ¶
func ToUpperSnakeCase ¶
func TrimNonASCII ¶
TrimNonASCII removes non-ASCII characters from the input string
func TrimSpaceEachLine ¶
func URLPathParamAddByPrefix ¶
URLPathParamAddByPrefix converts path parameters to By{ParamName}
func URLRemovePathParams ¶
func UpperCaseFirstLetter ¶
UpperCaseFirstLetter capitalizes the first letter of the input string
func UpperCaseFirstLetterOnly ¶
UpperCaseFirstLetterOnly capitalizes the first letter and lowercases the rest of the input string
func UppercaseAcronyms ¶
UppercaseAcronyms replaces acronyms in the input string with their uppercase form
Types ¶
This section is empty.