package schemaguard import "testing" func TestArrayLengthBounds(t *testing.T) { s := &Schema{root: map[string]any{"type": "array", "minItems": float64(1), "maxItems": float64(2)}, sibling: map[string]map[string]any{}} for _, tc := range []struct { doc []any fail bool }{{[]any{}, true}, {[]any{"a"}, false}, {[]any{"a", "b"}, false}, {[]any{"a", "b", "c"}, true}} { if got := len(s.Validate(tc.doc)) > 0; got != tc.fail { t.Fatalf("%v: failed=%v, want %v", tc.doc, got, tc.fail) } } }