schemadiff

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferValueHint added in v0.4.0

func InferValueHint(oldName string, oldDesc string, newName string, newDesc string) breaking.ValueHint

InferValueHint analyzes old and new variable names/descriptions to infer whether the value expression should be rewritten (e.g., .name → .id). It derives everything dynamically from the variable names — no hardcoded mappings.

func ToBreakingChanges

func ToBreakingChanges(results []DetectResult, version string) []breaking.BreakingChange

ToBreakingChanges converts schema diff results to the standard BreakingChange format.

Types

type DetectInput

type DetectInput struct {
	Source         string // registry source, e.g. "Azure/avm-res-network-virtualnetwork/azurerm"
	CurrentVersion string
	LatestVersion  string
}

DetectInput describes a module to check for breaking changes.

type DetectResult

type DetectResult struct {
	Source  string
	Changes []SchemaChange
	Error   error
}

DetectResult holds the results for a single module.

type Detector

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

Detector performs dynamic breaking change detection by diffing module schemas.

func NewDetector

func NewDetector() *Detector

NewDetector creates a new schema diff detector.

func (*Detector) Detect

func (d *Detector) Detect(inputs []DetectInput) []DetectResult

Detect checks multiple modules for breaking changes by diffing their schemas.

type ModuleFetcher

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

ModuleFetcher fetches and parses Terraform module schemas from the registry.

func NewModuleFetcher

func NewModuleFetcher() *ModuleFetcher

NewModuleFetcher creates a fetcher with a cache directory.

func (*ModuleFetcher) FetchModuleSchema

func (f *ModuleFetcher) FetchModuleSchema(source, version string) (*tfconfig.Module, error)

FetchModuleSchema fetches and parses a module at a specific version. source is the registry source like "Azure/avm-res-network-virtualnetwork/azurerm"

type SchemaChange

type SchemaChange struct {
	Kind        breaking.ChangeKind
	Severity    breaking.Severity
	Name        string // variable/output/provider name
	Description string
	OldValue    string
	NewValue    string
	ValueHint   breaking.ValueHint
}

SchemaChange represents a detected change between two module versions.

func DiffModules

func DiffModules(oldMod, newMod *tfconfig.Module, source string) []SchemaChange

DiffModules compares two parsed module schemas and returns detected changes.

Jump to

Keyboard shortcuts

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