def rewrite_ref(identifier, base_url):
    """
    The refs in the schemas are arbitrary identifiers, and cannot be used as-is as real network locations.
    This rewrites any of those arbitrary refs to be real urls servable by this endpoint.
    """
    if not base_url.endswith('/'):
        base_url += '/'
    if identifier.startswith('/schema/'):
        return base_url + identifier[1:]
    return identifier
