recursively collect and transform model schemas to definitions