File tree Expand file tree Collapse file tree 5 files changed +11
-2
lines changed
Expand file tree Collapse file tree 5 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ require (
1717
1818require (
1919 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
20- github.com/go-json-experiment/json v0.0.0-20250625182306-a9cfae7f3654
20+ github.com/go-json-experiment/json v0.0.0-20250626171732-1a886bd29d1b
2121 github.com/juju/ansiterm v1.0.0
2222 github.com/onsi/gomega v1.37.0
2323 golang.org/x/net v0.41.0
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ github.com/go-json-experiment/json v0.0.0-20250517221953-25912455fbc8 h1:o8UqXPI
88github.com/go-json-experiment/json v0.0.0-20250517221953-25912455fbc8 /go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M =
99github.com/go-json-experiment/json v0.0.0-20250625182306-a9cfae7f3654 h1:oSbYHc9OIFoLuGxc6oxRnEmv19baVLVEPfucUdXb/4A =
1010github.com/go-json-experiment/json v0.0.0-20250625182306-a9cfae7f3654 /go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M =
11+ github.com/go-json-experiment/json v0.0.0-20250626171732-1a886bd29d1b h1:ooF9/NzXkXL3OOLRwtPuQT/D7Kx2S5w/Kl1GnMF9h2s =
12+ github.com/go-json-experiment/json v0.0.0-20250626171732-1a886bd29d1b /go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M =
1113github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY =
1214github.com/go-logr/logr v1.4.2 /go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY =
1315github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI =
Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ func (v *validators) defaultRule(t reflect.Type) string {
211211 return "@double"
212212 case reflect .String :
213213 return "@string"
214+ default :
214215 }
215216 }
216217
Original file line number Diff line number Diff line change @@ -579,6 +579,12 @@ type Array struct {
579579 Validator Validator
580580}
581581
582+ func (va * Array ) SetLen (n int ) {
583+ if va .Kind () == reflect .Slice {
584+ va .Value .SetLen (n )
585+ }
586+ }
587+
582588func (va * Array ) UnmarshalDecode (dec * jsontext.Decoder , options json.Options ) error {
583589 tok , err := dec .ReadToken ()
584590 if err != nil {
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ func (validator *SliceValidator) String() string {
111111
112112func (validator * SliceValidator ) PostValidate (rv reflect.Value ) error {
113113 lenOfValue := uint64 (0 )
114- if ! rv .IsNil () {
114+ if rv . Kind () == reflect . Array || ! rv .IsNil () {
115115 lenOfValue = uint64 (rv .Len ())
116116 }
117117
You can’t perform that action at this time.
0 commit comments