crdschema

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package crdschema contains the implementation for crddiff, a utility for comparing two CRD schemas for detecting and reporting changes between those schemas.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDiffReport

func GetDiffReport(d *diff.Diff) string

GetDiffReport is a utility function to format the specified diff as a string

Types

type CommonOptions added in v0.7.0

type CommonOptions struct {
	// EnableUpjetExtensions enables special handling for the CRDs
	// generated by upjet.
	EnableUpjetExtensions bool
}

CommonOptions declares the common configuration options that customize how the diff between two OpenAPIv3 schemas are calculated.

type RevisionDiff

type RevisionDiff struct {
	// contains filtered or unexported fields
}

RevisionDiff can compute schema changes between the base CRD found at `basePath` and the revision CRD found at `revisionPath`.

func NewRevisionDiff

func NewRevisionDiff(basePath, revisionPath string, opts ...RevisionDiffOption) (*RevisionDiff, error)

NewRevisionDiff returns a new RevisionDiff initialized with the base and revision CRDs loaded from the specified base and revision CRD paths.

func (*RevisionDiff) GetBreakingChanges

func (d *RevisionDiff) GetBreakingChanges() (map[string]*diff.Diff, error)

GetBreakingChanges returns a diff representing the detected breaking schema changes between the base and revision CRDs.

type RevisionDiffOption added in v0.7.0

type RevisionDiffOption func(*RevisionDiff)

RevisionDiffOption is a functional option to configure the behavior of a RevisionDiff.

func WithRevisionDiffCommonOptions added in v0.7.0

func WithRevisionDiffCommonOptions(opts *CommonOptions) RevisionDiffOption

WithRevisionDiffCommonOptions configures the common diff options for a RevisionDiff.

type SchemaCheck

type SchemaCheck interface {
	GetBreakingChanges() (map[string]*diff.Diff, error)
}

SchemaCheck represents a schema checker that can return the set of breaking API changes between schemas.

type SelfDiff

type SelfDiff struct {
	// contains filtered or unexported fields
}

SelfDiff can compute schema changes between the consecutive versions declared for a CRD.

func NewSelfDiff

func NewSelfDiff(crdPath string, opts ...SelfDiffOption) (*SelfDiff, error)

NewSelfDiff returns a new SelfDiff initialized with a CRD loaded from the specified path.

func (*SelfDiff) GetBreakingChanges

func (d *SelfDiff) GetBreakingChanges() (map[string]*diff.Diff, error)

GetBreakingChanges returns the breaking changes found in the consecutive versions of a CRD.

type SelfDiffOption added in v0.7.0

type SelfDiffOption func(*SelfDiff)

SelfDiffOption is a functional option to configure the behavior of a SelfDiff.

func WithSelfDiffCommonOptions added in v0.7.0

func WithSelfDiffCommonOptions(opts *CommonOptions) SelfDiffOption

WithSelfDiffCommonOptions configures the common diff options for a SelfDiff.

Jump to

Keyboard shortcuts

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