warlock
warlock copied to clipboard
When Class is derived from BaseClass enum validation is not working correctly.
I am using MongoDB and since MongoDB adds a "_id" field before saving an element to the Database, I made a Base class as follows:
mongo_db_base_schema = {
'type': 'object',
'properties': {'_id': {}},
}
BaseClass = warlock.model_factory(mongo_db_base_schema)
When I now use SomeOtherModel = warlock.model_factory(other_model_schema, base_class=BaseClass)
where other_model_schema
contains an enum, my enum validation stops working.
EDIT: It does not seem to just break enum validation. For me it breaks the entire validation. So using a BaseClass is pretty much useless because my entire validation breaks.