File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -39,3 +39,9 @@ Then use it like:
3939``` bash
4040./validate config-schema.json < yourpath> /config.json
4141```
42+
43+ Or like:
44+
45+ ``` bash
46+ ./validate https://raw.githubusercontent.com/opencontainers/runtime-spec/v1.0.0-rc1/schema/schema.json < yourpath> /config.json
47+ ```
Original file line number Diff line number Diff line change 55 "io/ioutil"
66 "os"
77 "path/filepath"
8+ "strings"
89
910 "github.com/xeipuuv/gojsonschema"
1011)
@@ -16,12 +17,17 @@ func main() {
1617 os .Exit (1 )
1718 }
1819
19- schemaPath , err := filepath .Abs (os .Args [1 ])
20- if err != nil {
21- fmt .Println (err )
22- os .Exit (1 )
20+ schemaPath := os .Args [1 ]
21+ if ! strings .Contains (schemaPath , "://" ) {
22+ schemaPath , err := filepath .Abs (schemaPath )
23+ if err != nil {
24+ fmt .Println (err )
25+ os .Exit (1 )
26+ }
27+ schemaPath = "file://" + schemaPath
2328 }
24- schemaLoader := gojsonschema .NewReferenceLoader ("file://" + schemaPath )
29+ schemaLoader := gojsonschema .NewReferenceLoader (schemaPath )
30+
2531 var documentLoader gojsonschema.JSONLoader
2632
2733 if nargs > 1 {
You can’t perform that action at this time.
0 commit comments