swagtool

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendErrorSchema

func AppendErrorSchema(models *[]definitions.ModelMetadata, hasAnyErrorTypes bool)

func AreJSONsIdentical

func AreJSONsIdentical(json1 []byte, json2 []byte) (bool, error)

func FileExists

func FileExists(filename string) bool

func GetArrayItemType

func GetArrayItemType(fieldType string) string

Helper function to determine the item type of an array

func GetJsonNameFromTag

func GetJsonNameFromTag(tag string, defaultName string) string

Since the json tag can have multiple values (e.g. `json: "name,omitempty"`), this function returns the first value as the name, only.

func GetTagValue

func GetTagValue(tagStr string, tagName string, defaultValue string) string

GetTagValue extracts the value for a specific tag name from a struct tag string If the tag or value is not found, returns the default value Example usage:

tag := `json:"houseNumber" validate:"gte=1"`
jsonValue := GetTagValue(tag, "json", "default") // returns "houseNumber"
validateValue := GetTagValue(tag, "validate", "default") // returns "gte=1"

func HttpStatusCodeToString

func HttpStatusCodeToString(httpStatusCode runtime.HttpStatusCode) string

func IsDeprecated

func IsDeprecated(deprecationOptions *definitions.DeprecationOptions) bool

func IsFieldRequired

func IsFieldRequired(validationString string) bool

func IsHiddenAsset

func IsHiddenAsset(hideOptions *definitions.MethodHideOptions) bool

func IsMapObject

func IsMapObject(typeName string) bool

func IsPrimitiveType

func IsPrimitiveType(typeName string) bool

func IsSecurityNameInSecuritySchemes

func IsSecurityNameInSecuritySchemes(securitySchemes []definitions.SecuritySchemeConfig, securityName string) bool

func ParseBool

func ParseBool(value string) *bool

Helper function to parse boolean validation values

func ParseInteger

func ParseInteger(value string) *int64

Helper function to parse integer validation values

func ParseNumber

func ParseNumber(value string) *float64

Helper function to parse numeric validation values

func ParseUInteger

func ParseUInteger(value string) *uint64

Helper function to parse integer validation values

func ToOpenApiType

func ToOpenApiType(typeName string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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