patch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Op

type Op string
const (
	OpAdd     Op = "add"
	OpRemove  Op = "remove"
	OpReplace Op = "replace"
)

type Patch

type Patch struct {
	Op          Op
	Path        string            // JSON Pointer (RFC 6901) into the published document
	Value       *yaml.Node        // fragment to add/replace, copied from the code doc; nil for remove
	Match       map[string]string // identify an array element (parameters: name+in)
	CreatePath  bool              // for add: create missing map ancestors (new operations)
	Description string            // prose slot, filled by the later LLM stage
	Reason      string            // provenance: which drift this resolves (for review)
	Severity    diff.Severity
}

Patch is a single, reviewable INTENT to change the published document. It is data, not an edit: a later applier executes it only after human approval. Value comes from the code side; Description is a slot the LLM stage fills later (empty here, since this generator is fully deterministic).

func FromReport

func FromReport(report *diff.Report, code *ir.Document) ([]Patch, error)

FromReport turns detected drift into a deterministic list of patch intents. The code document supplies the authoritative values (code-first authority).

A shared schema drifts once per direction (request/response) for severity, but a document edit is direction-agnostic, so identical patches are deduped here.

Jump to

Keyboard shortcuts

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