Example #1
0
func TestParseOnlyString(t *testing.T) {
	data, err := ioutil.ReadFile("./examples/only-string.json")
	if err != nil {
		t.Fatal(err)
	}
	testData := string(data)
	schema, err := jsonschema.Parse(testData)
	if err != nil {
		t.Error(err)
	}
	if schema.Title != "Only String" {
		t.Error("Title is wrong")
	}
	if schema.Type.IsMatch("string") {
		t.Error("Type is wrong")
	}
}
Example #2
0
func TestParse(t *testing.T) {
	jsonschema.Parse(`{ "title": "test" , "test2":[1, 2, 3], "test3": { "test4": "test5", "test6": 6}}`)
}