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

Validating json with json-schema #130

Closed
rajsenthil opened this issue Sep 12, 2023 · 4 comments
Closed

Validating json with json-schema #130

rajsenthil opened this issue Sep 12, 2023 · 4 comments

Comments

@rajsenthil
Copy link

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
Copy link
Author

appreciate your response

@santhosh-tekuri
Copy link
Owner

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
Copy link
Owner

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

@rajsenthil
Copy link
Author

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

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