Documentation ¶
Overview ¶
Package optic supports linting OpenAPI specs with Optic CI and Sweater Comb.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // ChangeDate is when the proposed change would occur. ChangeDate string `json:"changeDate"` // ChangeResource is the proposed change resource name. ChangeResource string `json:"changeResource"` // ChangeVersion is the proposed change version. ChangeVersion Version `json:"changeVersion"` // ResourceVersions describes other resource version releases. ResourceVersions ResourceVersionReleases `json:"resourceVersions,omitempty"` }
Context provides Optic with external information needed in order to process API versioning lifecycle rules. For example, lifecycle rules need to know when a change is occurring, and what other versions have deprecated the OpenAPI spec version being evaluated.
type Optic ¶
type Optic struct {
// contains filtered or unexported fields
}
Optic runs a Docker image containing Optic CI and built-in rules.
func New ¶
New returns a new Optic instance configured to run the given OCI image and file sources. File sources may be a Git "treeish" (commit hash or anything that resolves to one such as a branch or tag) where the current working directory is a cloned git repository. If `from` is empty string, comparison assumes all changes are new "from scratch" additions. If `to` is empty string, spec files are assumed to be relative to the current working directory.
Temporary resources may be created by the linter, which are reclaimed when the context cancels.
func (*Optic) Match ¶
func (o *Optic) Match(rcConfig *config.ResourceSet) ([]string, error)
Match implements linter.Linter.
type Release ¶
type Release struct { // DeprecatedBy indicates the other release version that deprecates this // release. DeprecatedBy Version `json:"deprecatedBy"` }
Release describes a single resource-version-stability release.
type ResourceVersionReleases ¶
type ResourceVersionReleases map[string]VersionStabilityReleases
ResourceVersionReleases describes resource version releases.
type StabilityReleases ¶
StabilityReleases describes stability releases.
type Version ¶
Version describes an API resource version, a date and a stability. Stability is assumed to be GA if not specified.
type VersionStabilityReleases ¶
type VersionStabilityReleases map[string]StabilityReleases
VersionStabilityReleases describes version releases.