Invalid JSON schema does not error out
Closed this issue · 2 comments
brianshih1 commented
Hello! I am testing out adding resource with invalid json
, such as {}A
. In this example, the trailing character is invalid. However, AddResource
does not return an error.
Here is how to reproduce the error:
func TestInvalidJsonSchema(t *testing.T) {
if err := jsonschema.NewCompiler().AddResource("schema.json", strings.NewReader("{}A")); err == nil {
t.Error("error expected")
}
}
I was expecting decoder.Token)
to not return nil in this line of code. But it returns nil
.
santhosh-tekuri commented
fixed with 620600d
brianshih1 commented
thanks for the prompt fix!!