Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error validating on multi nested struct #120

Closed
dpsarr opened this issue Jan 24, 2022 · 0 comments
Closed

Error validating on multi nested struct #120

dpsarr opened this issue Jan 24, 2022 · 0 comments
Assignees
Labels
bug Something isn't working resolved

Comments

@dpsarr
Copy link

dpsarr commented Jan 24, 2022

System (please complete the following information):

  • OS: macOS [e.g. linux, macOS]
  • GO Version: 1.17
  • Pkg Version: 1.2.11

Describe the bug

If we have nested struct in second or more level it can't find a value to item.

To Reproduce

type MainStruct struct {
	Second []SecondStruct `json:"second" validate:"slice"`
}

type SecondStruct struct {
	Third []ThirdStruct `json:"third" validate:"slice"`
}

type ThirdStruct struct {
	Val string `json:"val" validate:"required"`
}

Expected behavior

I expect that Val from ThirdStruct would be validated.

Screenshots

I get error:

SecondStruct.0.ThirdStruct.0.Val
val is required and not empty

But this field in struct is filled.

@inhere inhere added the bug Something isn't working label Jan 24, 2022
@inhere inhere closed this as completed in 4dc93ac Mar 3, 2022
@inhere inhere added the resolved label Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved
Projects
None yet
Development

No branches or pull requests

2 participants