Documentation
¶
Overview ¶
Package conformance provides structural comparison of JSON API responses for validating PeeringDB compatibility layer output against the real PeeringDB API. Comparison is structure-only: field names, value types, and nesting depth are checked, but actual values are not.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Difference ¶
type Difference struct {
Path string // JSON path, e.g., "data[0].net_set[0].asn"
Kind string // "missing_field", "extra_field", "type_mismatch"
Details string // Human-readable description
}
Difference describes a structural mismatch between two JSON responses.
func CompareResponses ¶
func CompareResponses(reference, actual []byte) ([]Difference, error)
CompareResponses is a convenience wrapper that extracts structure from both JSON bodies and compares them. It returns differences found between the reference and actual response structures.
func CompareStructure ¶
func CompareStructure(reference, actual map[string]any) []Difference
CompareStructure compares the JSON structure of reference and actual maps. It checks field names, value types (string, number, bool, null, array, object), and nesting depth. Values are not compared. Differences are returned sorted by Path for deterministic output.