23andMe / Yamale

A schema and validator for YAML.
MIT License
680 stars 89 forks source link

empty schema generated IndexError exception #55

Closed mancusoa74 closed 5 years ago

mancusoa74 commented 5 years ago

hello, assume the simple block of code below:

schema = yamale.make_schema('schema.yml')

where: schema.yml is an empty file

this generates the following exception

File "....../lib/python3.7/site-packages/yamale/yamale.py", line 17, in make_schema s = Schema(raw_schemas[0], path, validators=validators) IndexError: list index out of range

I think would make sense to add a simple check to a non-empty yml schema.

if you think this make sense, let me know if you will accept a pull request for it. I can help to fix it.

The tool is great and I enjoy it

thnx Antonio

mildebrandt commented 5 years ago

Yes, a check for an empty file makes sense in this case. We should not be accepting empty schema files. We'd love a PR for this, let me know if you have any questions. Thanks!

tapaswenipathak commented 5 years ago

Hi folks: I added a PR let me know if it helps.

mildebrandt commented 5 years ago

Thanks so much! I'm going to be busy this week, so I might not get to it until the week after.

tapaswenipathak commented 5 years ago

No issues, feel free taking a look as time permits.