Validating json with json-schema
Closed this issue · 4 comments
rajsenthil commented
I created a sample repo to validate the json against this schema with the simple code.
I am getting the error as invalid jsonType: *main.Product
.
Please take a look.
rajsenthil commented
appreciate your response
santhosh-tekuri commented
this is the expected behaviour;
the documentation clearly says value must be raw json value
i.e it must be string, boolean, number, map, array and composite of these.
User defined structs are not allowed in value
santhosh-tekuri commented
to be clear: you must unmarshal json into interface{}
instead of Product
rajsenthil commented
Thanks for the response. It works with interface{}
.