private function resolvePathReferences(&$s, $limit = 20, $depth = 1)
    {
        if ($depth >= $limit) {
            return;
        }

        ++$depth;

        if (is_array($s) || is_object($s)) {
            foreach ($s as $k => &$v) {
                if ($k === "\$ref") {
                    $s = $this->paths[$v];
                } else {
                    $this->resolvePathReferences($v, $limit, $depth);
                }
            }
        }
    }