Skip to content

Commit dbc3af1

Browse files
authored
feat(resolve): file URI resolution (#90)
1 parent 08d62a2 commit dbc3af1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

util.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,15 @@ func FetchSchema(ctx context.Context, uri string, schema *Schema) error {
8181
}
8282
return json.Unmarshal(body, schema)
8383
}
84+
if u.Scheme == "file" {
85+
body, err := ioutil.ReadFile(u.Path)
86+
if err != nil {
87+
return err
88+
}
89+
if schema == nil {
90+
schema = &Schema{}
91+
}
92+
return json.Unmarshal(body, schema)
93+
}
8494
return fmt.Errorf("URI scheme %s is not supported for uri: %s", u.Scheme, uri)
8595
}

0 commit comments

Comments
 (0)