keleshev / schema

Schema validation just got Pythonic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use value depends of data given

RechieKho opened this issue · comments

Oh my, this is hard to explain...

This is my schema

config_schema = Schema({
    "PROJECT": {
        "include": And(Use(lambda value: os.path.abspath(value)), lambda value: os.path.isdir(value)),
        "entry": # This is where I met a problem
    }
})

So, the "include" will be a valid path while "entry" will be a file in the "include" path. So I need to access the "include" value (the path) from "entry" so I can validate whether the file that "entry" refers to is in the "include" path. Unfortunately, I can't find a way to do that (mostly because I don't know how to describe this problem). Thank you for understanding.