Skip to content

Not able to validate custom struct #111

@fangming-ning-sp

Description

@fangming-ning-sp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions