Fix TestFileSpecSchema
@@ -17,13 +17,15 @@ func TestFileSpecSchema(t *testing.T) {
schemaLoader := gojsonschema.NewBytesLoader(schema)
// Validate all specs in ../testdata/specs against the filespec-schema.json
- filepath.Walk("../testdata/specs", func(path string, info os.FileInfo, err error) error {
+ filepath.Walk(filepath.Join("..", "testdata", "specs"), func(path string, info os.FileInfo, err error) error {
assert.NoError(t, err)
if info.IsDir() {
return nil
}
- documentLoader := gojsonschema.NewReferenceLoader("file://" + path)
+ specFileContent, err := ioutil.ReadFile(path)
+ assert.NoError(t, err)
+ documentLoader := gojsonschema.NewBytesLoader(specFileContent)
result, err := gojsonschema.Validate(schemaLoader, documentLoader)
assert.NoError(t, err)
assert.True(t, result.Valid(), result.Errors())
