keleshev / schema

Schema validation just got Pythonic
MIT License
2.87k stars 214 forks source link

Should be an instance of 'list', but no list is defined in schema #257

Closed fi-do closed 3 years ago

fi-do commented 3 years ago

Hello Keleshev,

I started to use schema to check the config files of my projects and I really started to like it. In my last project I had an occurrence when validating the following python dictionary:

With the following schema: I got the follwing error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/dominik/Projekte/path_to_script/venv/lib/python3.6/site-packages/schema.py", line 398, in validate
    raise SchemaError([message] + x.autos, [e] + x.errors)
schema.SchemaError: Key 'data_sys' error:
Key 'dns' error:
Key 'zone' error:
{'user.zone.tld.': {'email': 'user@zone.tld', 'type_': 'PLACEHOLDER'}} should be instance of 'list'

But when checking my validation schema, I don't use any [ ] to describe a list at zone.

//Edit: Look like to me that the list gets added around zone after calling the Schema function.(see schema object). //Edit: Original python dict for generating schema instance. //Edit: Problem solved by reworking python dict.