Skip to content

How to Get ValidationError back from Validate? #131

Closed Answered by santhosh-tekuri
johnwrobinson asked this question in Q&A
Discussion options

You must be logged in to vote

in golang, function signature always will have error. you have to check for specific error type as shown below:

var err = schema.Validate(f)
if verr, ok = err.(*jsonschema.ValidationError); ok {
    fmt.Println(verr.InstanceLocation)
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@johnwrobinson
Comment options

Answer selected by johnwrobinson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants