Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadTemplate ¶
func LoadTemplate(loader SourceLoader, templatePath string, token string) ([]byte, error)
LoadTemplate fetches template content from a given path, using the appropriate loader. It supports local files, GitHub URLs, and HTTP URLs.
func LoadValidations ¶
func LoadValidations(filePath string, token string) ([]spec.Validation, error)
LoadValidations loads a YAML file containing a list of validations.
Types ¶
type GithubLoader ¶
type GithubLoader struct {
Path string
Ref string // Consolidated Git reference (branch, tag, commit)
Repo string
Subdir string
User string
}
func ParseGitHubURL ¶
func ParseGitHubURL(url string) (GithubLoader, bool)
ParseGitHubURL parses a GitHub URL string into a GithubLoader struct.
func (*GithubLoader) GetBasePath ¶
func (g *GithubLoader) GetBasePath() string
GetBasePath returns the base URL for resolving relative template paths in a GitHub repository.
func (*GithubLoader) GetRawContentURL ¶
func (g *GithubLoader) GetRawContentURL(relativePath string, isSpec bool) string
GetRawContentURL constructs the URL for fetching a raw file from GitHub. It handles different scenarios: specific relative paths, blob URLs, and repo-root spec files.
func (*GithubLoader) LoadSpec ¶
func (g *GithubLoader) LoadSpec(token string) (*spec.SpecConfig, error)
LoadSpec fetches the spec file from a GitHub repository.
type HTTPLoader ¶
HTTPLoader handles loading from a direct http(s) URL.
func (*HTTPLoader) GetBasePath ¶
func (h *HTTPLoader) GetBasePath() string
GetBasePath returns the base URL for resolving relative template paths.
func (*HTTPLoader) LoadSpec ¶
func (h *HTTPLoader) LoadSpec(token string) (*spec.SpecConfig, error)
LoadSpec fetches the spec file from a remote HTTP URL.
type LocalLoader ¶
LocalLoader handles loading from the local filesystem.
func (*LocalLoader) GetBasePath ¶
func (l *LocalLoader) GetBasePath() string
GetBasePath returns the base directory for local files.
func (*LocalLoader) LoadSpec ¶
func (l *LocalLoader) LoadSpec(token string) (config *spec.SpecConfig, err error)
LoadSpec reads the spec file from the local filesystem.
type SourceLoader ¶
type SourceLoader interface {
// LoadSpec fetches and parses the spec.yaml file.
LoadSpec(token string) (*spec.SpecConfig, error)
// GetBasePath returns the base path for resolving relative template paths.
GetBasePath() string
}
SourceLoader defines the interface for any configuration source
func NewSourceLoader ¶
func NewSourceLoader(path string, token string) (SourceLoader, error)
NewSourceLoader determines the appropriate loader (Local, GitHub, HTTP) based on the provided path.