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

Not able to validate custom struct #111

Open
fangming-ning-sp opened this issue Sep 17, 2021 · 1 comment
Open

Not able to validate custom struct #111

fangming-ning-sp opened this issue Sep 17, 2021 · 1 comment

Comments

@fangming-ning-sp
Copy link

Environment

GO 1.16

What is your OS and version?

Mac 11.3.1 (Big Sur)

What version of qri are you using (qri version)?

0.2.0

What version of Qri Desktop are you using?

N/A

What browser(s) did you use? What version?

N/A

Issue

The Validate method always pass for custom struct

What did you do?

Define a custom struct

type input struct {
  Name            string. `json:"name"`
  Description  string. `json:"description"`
}

Fill in data

i := &input{
  Name:           "name",
  Description: "description",
}

Validate

schema.Validate(i)

What happened?

The Validate method passed with no errors.
If I serilize the custom struct into a map, then pass that into the Validate method, validation error does appear.

What did you expect to happen?

Should see validation error when validating struct

@JimmyPettersson85
Copy link

I'm seeing the same issue.

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

2 participants