def generate_schema_mapping(resolver, schema_uri, depth=1):
    """ Try and recursively iterate a JSON schema and to generate an ES mapping
    that encasulates it. """
    visitor = SchemaVisitor({'$ref': schema_uri}, resolver)
    return _generate_schema_mapping(visitor, set(), depth)