schema

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSchemaVersion = errors.New("invalid schema version")

ErrInvalidSchemaVersion is used when the schemaVersion of two resources do not match exactly.

Functions

func MustParseConstraint added in v1.0.8

func MustParseConstraint(value string) *semver.Constraints

MustParseConstraint converts the string value to a semver range. This will panic if it is not a valid constraint and is intended to initialize package variables with well-known schema version values. Example: var SupportedInstallationSchemaVersion = schema.MustParseConstraint("1.0.x")

func ValidateSchemaVersion

func ValidateSchemaVersion(strategy CheckStrategy, supported *semver.Constraints, specified string, defaultVersion *semver.Version) (bool, error)

ValidateSchemaVersion checks the specified schema version against the supported version, returning if the result is a warning only. Warnings are returned when the versions are not an exact match. A warning is not returned when CheckStrategyNone is used.

Types

type CheckStrategy

type CheckStrategy string

CheckStrategy is an enum of values for handling schemaVersion comparisons of two resources. Allowed values are: CheckStrategyExact, CheckStrategyMinor, CheckStrategyMajor, CheckStrategyNone.

const (
	// CheckStrategyExact requires that resource schemaVersion values exactly match the supported schema version.
	CheckStrategyExact CheckStrategy = "exact"

	// CheckStrategyMinor requires that resource schemaVersion values match the MAJOR.MINOR portion of the supported schema version.
	CheckStrategyMinor CheckStrategy = "minor"

	// CheckStrategyMajor requires that resource schemaVersion values exactly match the MAJOR portion of the supported schema version.
	CheckStrategyMajor CheckStrategy = "major"

	// CheckStrategyNone ignores the resource schemaVersion. Errors will most likely ensue but have fun!
	CheckStrategyNone CheckStrategy = "none"
)

Jump to

Keyboard shortcuts

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