compare

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompareOption

type CompareOption func(*compareConfig)

CompareOption configures comparison behavior.

func AllowExtraFields

func AllowExtraFields() CompareOption

AllowExtraFields treats fields present in new but missing in old as non-diffs.

func AllowExtraTypes

func AllowExtraTypes() CompareOption

AllowExtraTypes treats types present in new but missing in old as non-diffs.

func IgnoreDescriptions

func IgnoreDescriptions() CompareOption

IgnoreDescriptions ignores description differences on types and fields.

func IgnoreDirectiveArgs

func IgnoreDirectiveArgs(directives ...string) CompareOption

IgnoreDirectiveArgs ignores argument differences on specified directives.

func IgnoreDirectives

func IgnoreDirectives(names ...string) CompareOption

IgnoreDirectives skips named directives entirely during comparison. Both missing and extra occurrences of these directives are ignored.

func KnownIssues

func KnownIssues(paths ...string) CompareOption

KnownIssues marks diffs at specified paths as known issues, moving them to Result.KnownIssues instead of Result.Diffs.

func SkipSystemTypes

func SkipSystemTypes() CompareOption

SkipSystemTypes excludes types starting with "__" from comparison.

func SkipTypes

func SkipTypes(names ...string) CompareOption

SkipTypes excludes specific types by name from comparison.

type Diff

type Diff struct {
	Path    string   // dot-separated path, e.g. "types.User.fields.name"
	Kind    DiffKind // MISSING, EXTRA, or CHANGED
	Message string   // human-readable description
}

Diff represents a single structural difference between two schemas.

type DiffKind

type DiffKind int

DiffKind categorizes a difference between two schemas.

const (
	DiffMissing DiffKind = iota // present in old, absent in new
	DiffExtra                   // absent in old, present in new
	DiffChanged                 // present in both, but different
)

func (DiffKind) String

func (k DiffKind) String() string

type Result

type Result struct {
	Diffs       []Diff
	KnownIssues []Diff
}

Result holds comparison output: actual diffs and known issues.

func Compare

func Compare(old, new *ast.Schema, opts ...CompareOption) *Result

Compare structurally compares two schemas and returns differences. The old schema is treated as the reference; the new schema is checked against it.

func (*Result) Equal

func (r *Result) Equal() bool

Equal returns true when there are no unexpected diffs.

Jump to

Keyboard shortcuts

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