xeipuuv/gojsonschema

[BUG] Validation not working

Opened this issue · 1 comments

ciolo commented

Hi,
Maybe I got the configuration wrong, but following the examples in the README the validation doesn't work correctly. In detail:

documentLoader := gojsonschema.NewGoLoader(feed)
schemaLoader := gojsonschema.NewGoLoader(v.Schema)
result, err := gojsonschema.Validate(schemaLoader, documentLoader)

feed and v.Schema they could be anything and validation returns no errors. Why? Can you help me plz?

Thanks.

I'm also experiencing something like this. In my case I'm doing it like this:

	sl := gojsonschema.NewSchemaLoader()
	sl.Validate = true

	if err := sl.AddSchemas(gojsonschema.NewStringLoader(string(jsonStr))); err != nil {
		return err
	}

I was expecting that this would return an error if someone would use for example type: foobar in their jsonschema. But nothing happens...no errors.