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 validator a struct that overiding field in embedding struct #969

Open
ghost opened this issue Jun 29, 2022 · 0 comments
Open

How to validator a struct that overiding field in embedding struct #969

ghost opened this issue Jun 29, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 29, 2022

Package version v10:

Question

I want to validate the B struct, when T2 is not empty can pass the vaildate . the 'T1' in A is ignored.

type A struct {
	T1 string `validate:"required"`
	T2 string `validate:"required"`
}
type B struct {
	T1 string // is not required
	A
}
// In this case, json works good. sometimes I need to change the A sturct.

I try the 'structonly',but does't work.
I need your guidance.

I'm sorry my English is poor
At last,Thank you for your work.

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

0 participants