diff

package
v0.26.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Path           string         `json:"path"`
	Type           ChangeType     `json:"type"`
	OldValue       interface{}    `json:"oldValue,omitempty"`
	NewValue       interface{}    `json:"newValue,omitempty"`
	Classification Classification `json:"classification"`
	Reason         string         `json:"reason"`
}

Change represents a single detected change between two contracts.

type ChangeType

type ChangeType int

ChangeType describes how a field changed.

const (
	Added ChangeType = iota
	Removed
	Modified
)

func (ChangeType) MarshalJSON

func (t ChangeType) MarshalJSON() ([]byte, error)

func (ChangeType) String

func (t ChangeType) String() string

type Classification

type Classification int

Classification represents the severity of a change.

const (
	NonBreaking       Classification = iota // Consumers are not affected.
	PotentialBreaking                       // Consumers may be affected.
	Breaking                                // Consumers are definitely affected.
)

func (Classification) MarshalJSON

func (c Classification) MarshalJSON() ([]byte, error)

func (Classification) String

func (c Classification) String() string

type Result

type Result struct {
	Classification Classification `json:"classification"`
	Changes        []Change       `json:"changes"`
	SBOMDiff       *sbom.Result   `json:"sbomDiff,omitempty"`
}

Result holds the output of comparing two contracts.

func Compare

func Compare(old, new *contract.Contract, oldFS, newFS fs.FS) *Result

Compare compares two contracts and produces a classified diff result. oldFS and newFS provide access to referenced files (OpenAPI specs, JSON Schemas) within each contract's bundle. Either may be nil if file-level diffs are not needed.

Jump to

Keyboard shortcuts

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