def resolveSchema(schema, schemaStore):
 result = copy.deepcopy(schema)
 resolver = LocalRefResolver(base_uri='', referrer=schema, store=schemaStore)
 def resolve(obj):
  if isinstance(obj, list):
   for item in obj:
    resolve(item)
   return
  if isinstance(obj, dict):
   if ('$ref' in obj):
    with resolver.resolving(obj[u'$ref']) as resolved:
     resolve(resolved)
     obj.clear()
     obj.update(resolved)
   else:
    for value in obj.values():
     resolve(value)
 resolve(result)
 result['$schema'] = 'http://json-schema.org/draft-04/schema#'
 return result

def resolveSchema ( schema , schemaStore ) : result = copy . deepcopy ( schema ) resolver = LocalRefResolver ( base_uri = '' , referrer = schema , store = schemaStore ) def resolve ( obj ) : if isinstance ( obj , list ) : for item in obj : resolve ( item ) return if isinstance ( obj , dict ) : if ( '$ref' in obj ) : with resolver . resolving ( obj [ u'$ref' ] ) as resolved : resolve ( resolved ) obj . clear ( ) obj . update ( resolved ) else : for value in obj . values ( ) : resolve ( value ) resolve ( result ) result [ '$schema' ] = 'http://json-schema.org/draft-04/schema#' return result
recursively resolve all i{$ref} json references in a json schema .