Hmm, yeah that's actually akin to a hand-rolled permission system I've done before. It might be a little bit trickier to generate as you say, as you'd also need some runtime piece to it and not just types (possibly just output an object or array of valid types then use a base object/proxy with catch-all functions to translate between function name and schema name)