File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 11{
2- "$schema" : " http ://json-schema.org/draft-07/schema# " ,
2+ "$schema" : " https ://json-schema.org/draft-07/schema" ,
33 "$id" : " compose_spec.json" ,
44 "type" : " object" ,
55 "title" : " Compose Specification" ,
Original file line number Diff line number Diff line change @@ -18,8 +18,10 @@ package schema
1818
1919import (
2020 "os"
21+ "path/filepath"
2122 "testing"
2223
24+ "github.com/xeipuuv/gojsonschema"
2325 "gopkg.in/yaml.v3"
2426 "gotest.tools/v3/assert"
2527)
@@ -251,3 +253,14 @@ func TestValidateVariables(t *testing.T) {
251253 assert .NilError (t , err )
252254 assert .NilError (t , Validate (config ))
253255}
256+
257+ func TestSchema (t * testing.T ) {
258+ abs , err := filepath .Abs ("compose-spec.json" )
259+ assert .NilError (t , err )
260+ schema := gojsonschema .NewReferenceLoader ("file:///" + abs )
261+ sl := gojsonschema .NewSchemaLoader ()
262+ sl .Draft = gojsonschema .Draft7
263+ sl .Validate = true
264+ _ , err = sl .Compile (schema )
265+ assert .NilError (t , err )
266+ }
You can’t perform that action at this time.
0 commit comments