Skip to content

Commit

Permalink
feat(resolve): file URI resolution (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu authored Jan 12, 2021
1 parent 08d62a2 commit dbc3af1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,15 @@ func FetchSchema(ctx context.Context, uri string, schema *Schema) error {
}
return json.Unmarshal(body, schema)
}
if u.Scheme == "file" {
body, err := ioutil.ReadFile(u.Path)
if err != nil {
return err
}
if schema == nil {
schema = &Schema{}
}
return json.Unmarshal(body, schema)
}
return fmt.Errorf("URI scheme %s is not supported for uri: %s", u.Scheme, uri)
}

0 comments on commit dbc3af1

Please sign in to comment.