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

How to validate with nested struct ? #107

Closed
dederz opened this issue Sep 2, 2021 · 1 comment
Closed

How to validate with nested struct ? #107

dederz opened this issue Sep 2, 2021 · 1 comment

Comments

@dederz
Copy link

dederz commented Sep 2, 2021

I'm sorry but I don't get the example, that doesn't work, or at least I take it wrong.
If I take the basic struct
type User struct { Id int64 json:"id"Email string json:"email"Detail UserDetail json:"detail"`
}

type UserDetail struct {
Description string json:"description"
Referer int64 json:"referer"
}
Here's the JSON that is posted :{
"email": "toto@toto.io",
"detail": {
"referer":97
}
}`

If I want to apply a rule to the referer field, how can I set that up ?

Thx

@dederz
Copy link
Author

dederz commented Sep 3, 2021

An "omitempty" config inside my struct was causing troubles for the validation phase. My bad !

@dederz dederz closed this as completed Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant