def swagger_escape(s):  # pragma: no cover
    """
    / and ~ are special characters in JSON Pointers,
    and need to be escaped when used literally (for example, in path names).

    https://swagger.io/docs/specification/using-ref/#escape
    """
    return s.replace('~', '~0').replace('/', '~1')