brandur / json_schema

A JSON Schema V4 and Hyperschema V4 parser and validator.
MIT License
230 stars 45 forks source link

Produce an error on empty files #70

Closed brandur closed 7 years ago

brandur commented 7 years ago

Currently, when given an empty data file, the validation command produces usage information, which is super confusing and doesn't tell the user anything. This is a side effect of the fact that both JSON.load and YAML.load will produce a nil when they're passed an empty string, so the command finishes with an empty set of errors but also unsuccessfully.

Here we add a new error message so that reasonable output is produced in this error case.