utils

package
v0.2.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AttributeNameRegexp = regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_]*$`)
View Source
var EmailDomainRegexp = regexp.MustCompile(`^$|^(((\*|([a-zA-Z0-9_\-]{1,63}))\.)(?:[a-zA-Z0-9_\-]{1,63}\.)*(?:[a-zA-Z]{2,})|((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(localhost))$`)
View Source
var IPRegexp = regexp.MustCompile(`^$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$`)
View Source
var UrlRegexp = regexp.MustCompile(`^(((http|https):\/\/(\*\.)?localhost)|(https:\/\/(([\w-])+|(((\*\.([\w-]{1,63}\.))?([\w-]{1,63}\.)*)|(([\w-]{1,63}\.)*(\*\.)?([\w-]{1,63}\.){2,}))([a-zA-Z]{2,}))))(:[\d]+)?(\/([\w-()@:%+.~?&/=])*)?$`)
View Source
var UuidRegexp = regexp.MustCompile(`^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$`)

Functions

func CheckClientAuthMethod

func CheckClientAuthMethod(typeExpr path.Expression, authMethods []string) validator.String

func DefaultValuesChecker

func DefaultValuesChecker(defaultParamValues []attr.Value) validator.Set

func PrintDefaultSchemas

func PrintDefaultSchemas(schemas []attr.Value) string

string together the default schemas

func ValidAttributeName

func ValidAttributeName() validator.String

Checks that the String held in the attribute is a valid s\attribute name

func ValidCertificate

func ValidCertificate() validator.String

func ValidDateTime

func ValidDateTime() validator.String

func ValidEmailDomain

func ValidEmailDomain() validator.String

Checks that the String held in the attribute is a valid Email Domain

func ValidIPAddress

func ValidIPAddress() validator.String

Checks that the String held in the attribute is a valid IP Address

func ValidJSON

func ValidJSON() validator.String

func ValidType

func ValidType(typeExpr path.Expression, validValues []string) validator.Object

func ValidUUID

func ValidUUID() validator.String

Checks that the String held in the attribute is a valid UUID

func ValidUrl

func ValidUrl() validator.String

Checks that the String held in the attribute is a valid URL

func ValidValuesString

func ValidValuesString(values []string) string

string together the array of valid values for the attribute

Types

type DefaultValuesValidator

type DefaultValuesValidator struct {
	DefaultParamValues types.Set
}

func (DefaultValuesValidator) CheckDefaultValues

func (s DefaultValuesValidator) CheckDefaultValues(ctx context.Context, req validator.SetRequest, resp *validator.SetResponse) ([]string, bool)

checks if all the default values are present in the attribute

func (DefaultValuesValidator) Description

func (s DefaultValuesValidator) Description(_ context.Context) string

func (DefaultValuesValidator) MarkdownDescription

func (s DefaultValuesValidator) MarkdownDescription(_ context.Context) string

func (DefaultValuesValidator) ValidateSet

Jump to

Keyboard shortcuts

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