Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileSource ¶
type FileSource interface { // Name returns a string describing the file source. Name() string // Match returns a slice of logical paths to spec files that should be // linted from the given resource set configuration. Match(*config.ResourceSet) ([]string, error) // Prefetch retrieves an entire directory tree starting at the given root, // for remote sources which need to download and cache a local copy. For // such sources, a call to Fetch without a pre-fetched root will error. // The path to the local copy of the "root" is returned. // // For local sources, this method may be a no-op / passthrough. // // The root must contain all relative OpenAPI $ref references in all linted // specs, or the lint will fail. Prefetch(root string) (string, error) // Fetch retrieves the contents of the requested logical path as a local // file and returns the absolute path where it may be found. An empty // string, rather than an error, is returned if the file does not exist. Fetch(path string) (string, error) // Close releases any resources consumed in content retrieval. Any files // returned by Fetch will no longer be available after calling Close, and // any further calls to Fetch will error. Close() error }
FileSource defines a source of spec files to lint. This abstraction allows linters to operate seamlessly over version control systems and local files.
type LocalFSSource ¶
type LocalFSSource struct{}
LocalFSSource is a FileSource that resolves files from the local filesystem relative to the current working directory.
func (LocalFSSource) Fetch ¶
func (LocalFSSource) Fetch(path string) (string, error)
Fetch implements FileSource.
func (LocalFSSource) Match ¶
func (LocalFSSource) Match(rcConfig *config.ResourceSet) ([]string, error)
Match implements FileSource.
Click to show internal directories.
Click to hide internal directories.