validation

package
v0.0.77 Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License: 0BSD Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidationTypeMap = map[string]*regexp.Regexp{
	"USER_NAME":    regexp.MustCompile("^[a-z0-9]{3,20}$"),
	"APP_NAME":     regexp.MustCompile("^[a-z0-9-]{3,20}$"),
	"VERSION_NAME": regexp.MustCompile("^[a-z0-9.]{3,20}$"),
	"SEARCH_TERM":  regexp.MustCompile("^[a-z0-9]{0,20}$"),
	"PASSWORD":     regexp.MustCompile("^[a-zA-Z0-9!@#$%&_,.?]{8,30}$"),
	"EMAIL":        regexp.MustCompile(`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`),
	"NUMBER":       regexp.MustCompile("^[0-9]{1,20}$"),
}

Functions

func AssertYamlEquality

func AssertYamlEquality(t *testing.T, a, b []byte)

func CompleteDockerComposeYaml

func CompleteDockerComposeYaml(maintainer, appName, filePath string) error

func IsValidURLPath

func IsValidURLPath(path string) bool

func ReadBody added in v0.0.77

func ReadBody[T any](w http.ResponseWriter, r *http.Request) (*T, error)

func Validate added in v0.0.77

func Validate(input, validationType string) error

func ValidateSecret added in v0.0.77

func ValidateSecret(input string) error

As we do not receive sensitive data in request bodies such as secrets or cookie values, this is a separate concern in a separate function.

func ValidateVersion

func ValidateVersion(zipBytes []byte, maintainerName, appName string) error

func ZipDirectory

func ZipDirectory(dirPath string) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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