schema dumper

This is adapted from @agios' and @Altonymous' pull requests