File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "$schema" : " http ://json-schema.org/draft-07/schema# " ,
2
+ "$schema" : " https ://json-schema.org/draft-07/schema" ,
3
3
"$id" : " compose_spec.json" ,
4
4
"type" : " object" ,
5
5
"title" : " Compose Specification" ,
Original file line number Diff line number Diff line change @@ -18,8 +18,10 @@ package schema
18
18
19
19
import (
20
20
"os"
21
+ "path/filepath"
21
22
"testing"
22
23
24
+ "github.com/xeipuuv/gojsonschema"
23
25
"gopkg.in/yaml.v3"
24
26
"gotest.tools/v3/assert"
25
27
)
@@ -251,3 +253,14 @@ func TestValidateVariables(t *testing.T) {
251
253
assert .NilError (t , err )
252
254
assert .NilError (t , Validate (config ))
253
255
}
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