santhosh-tekuri/jsonschema

Validating json with json-schema

Closed this issue · 4 comments

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.

appreciate your response

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

to be clear: you must unmarshal json into interface{} instead of Product

Thanks for the response. It works with interface{}.