schema

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 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 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