Documentation
¶
Index ¶
- Variables
- func HasNoSpaces(s string) bool
- func IsValidRemoteURL(rawURL string) bool
- func IsValidRepositoryURL(source RepositorySource, url string) bool
- func IsValidSubfolderPath(path string) bool
- func IsValidTemplatedURL(rawURL string, availableVariables []string, allowTemplates bool) bool
- func IsValidURL(rawURL string) bool
- func ValidatePackage(ctx context.Context, pkg model.Package, serverName string) error
- func ValidatePublishRequest(ctx context.Context, req apiv0.ServerJSON, cfg *config.Config) error
- func ValidateServerJSON(serverJSON *apiv0.ServerJSON) error
- type RepositorySource
Constants ¶
This section is empty.
Variables ¶
var ( // Repository validation errors ErrInvalidRepositoryURL = errors.New("invalid repository URL") ErrInvalidSubfolderPath = errors.New("invalid subfolder path") // Package validation errors ErrPackageNameHasSpaces = errors.New("package name cannot contain spaces") ErrReservedVersionString = errors.New("version string 'latest' is reserved and cannot be used") ErrVersionLooksLikeRange = errors.New("version must be a specific version, not a range") // Remote validation errors ErrInvalidRemoteURL = errors.New("invalid remote URL") // Registry validation errors ErrUnsupportedRegistryBaseURL = errors.New("unsupported registry base URL") ErrMismatchedRegistryTypeAndURL = errors.New("registry type and base URL do not match") // Argument validation errors ErrNamedArgumentNameRequired = errors.New("named argument name is required") ErrInvalidNamedArgumentName = errors.New("invalid named argument name format") ErrArgumentValueStartsWithName = errors.New("argument value cannot start with the argument name") ErrArgumentDefaultStartsWithName = errors.New("argument default cannot start with the argument name") // Server name validation errors ErrMultipleSlashesInServerName = errors.New("server name cannot contain multiple slashes") ErrInvalidServerNameFormat = errors.New("server name format is invalid") )
Error messages for validation
Functions ¶
func HasNoSpaces ¶
HasNoSpaces checks if a string contains no spaces
func IsValidRemoteURL ¶
IsValidRemoteURL checks if a URL is valid for remotes (stricter than packages - no localhost allowed)
func IsValidRepositoryURL ¶
func IsValidRepositoryURL(source RepositorySource, url string) bool
IsValidRepositoryURL checks if the given URL is valid for the specified repository source
func IsValidSubfolderPath ¶
IsValidSubfolderPath checks if a subfolder path is valid
func IsValidTemplatedURL ¶
IsValidTemplatedURL validates a URL with template variables against available variables For packages: validates that template variables reference package arguments or environment variables For remotes: disallows template variables entirely
func IsValidURL ¶
IsValidURL checks if a URL is in valid format (basic structure validation)
func ValidatePackage ¶
ValidatePackage validates that the package referenced in the server configuration is: 1. allowed on the official registry (based on registry base url); and 2. owned by the publisher, by checking for a matching server name in the package metadata
func ValidatePublishRequest ¶
ValidatePublishRequest validates a complete publish request including extensions
func ValidateServerJSON ¶
func ValidateServerJSON(serverJSON *apiv0.ServerJSON) error
Types ¶
type RepositorySource ¶
type RepositorySource string
RepositorySource represents valid repository sources
const ( SourceGitHub RepositorySource = "github" SourceGitLab RepositorySource = "gitlab" )