New api: generate mappings from a descriptor object

Not ready to merge
name the function, it's the most important component from the file ;)