Add JSONEqual semantic comparer - #23
Conversation
* Add JSONEqual to compare JSON strings and structs ignoring key order and whitespace.
* Replace interface{} with any across APIs, tests, and documentation.
PR Summary by QodoAdd JSONEqual semantic comparer for order/whitespace-insensitive JSON diffs
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
1.
|
* Add JSONOpt with subset, ignore paths, and use number options; keep JSONEqual unchanged by default. * Document JSONContains and options in comparers, api, and examples.
* Report marshal and unmarshal failures with distinct prefixes instead of labeling all errors as invalid JSON. * Update JSONEqual tests and comparers documentation to match the new messages.
Quality check
Summary
Adds
JSONEqual, a comparer that normalizes both sides to JSON DOM shape beforecmp.Diff, so tests ignore key ordering and whitespace when comparing struct output to embedded JSON fixtures or JSON strings.Also replaces
interface{}withanyacross public APIs, tests, and documentation for Go 1.18+ idioms. Documentation covers usage with//go:embedand comparer selection;TestJSONEqualcovers key order, whitespace, struct-vs-JSON, invalid JSON, and number normalization.