comparisoninternal

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff added in v0.11.0

func Diff(reference, candidate *Normalised) (differences []string)

Diff returns the paths at which two normalised payloads differ, without values.

Types

type Normalised added in v0.11.0

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

Normalised is one payload after every applicable normaliser has run.

func Raw added in v0.25.0

func Raw(payload any) *Normalised

Raw wraps an untyped payload that no normaliser applies to.

func (*Normalised) CanonicalJSON added in v0.14.0

func (n *Normalised) CanonicalJSON() ([]byte, error)

CanonicalJSON encodes the payload with sorted object keys, so structurally equal payloads encode identically. A removed root encodes as null.

type Plan

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

Plan binds JavaScript normaliser declarations to one declared schema. It is immutable after construction and safe to share across normalisations.

func NewPlan

func NewPlan(loaded *schema.Schema, fields []javascript.FieldTarget, messages []schema.TypeRef) (*Plan, error)

NewPlan resolves and validates every declared normaliser target before activation.

func (*Plan) Normalise added in v0.11.0

func (p *Plan) Normalise(
	ctx context.Context,
	evaluator *javascript.Evaluator,
	root *schema.Type,
	side string,
	payload any,
) (*Normalised, error)

Normalise applies the plan to one decoded JSON payload of type root, which it takes ownership of and mutates. side only labels log records.

func (*Plan) Schema

func (p *Plan) Schema() *schema.Schema

Schema returns the declared schema bound to the plan.

Jump to

Keyboard shortcuts

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