private static List<String> parseJsonPointer(String pointer) {
        if (pointer.isEmpty()) {
            return Collections.emptyList();
        } else if (pointer.startsWith("#")) {
            // Strip a leading "#" if present.
            return parseJsonPointer(pointer.substring(1));
        } else if (!pointer.startsWith("/")) {
            throw new IllegalArgumentException("JSON pointer must start with '/': " + pointer);
        }

        List<String> parts = new ArrayList<>();
        int start = 0;

        for (int i = 0; i < pointer.length(); i++) {
            if (pointer.charAt(i) == '/') {
                if (start > 0) {
                    String part = pointer.substring(start, i);
                    parts.add(unescape(part));
                }
                start = i + 1;
            }
        }

        parts.add(unescape(pointer.substring(start)));
        return parts;
    }
Parses a JSON pointer.

<p>A JSON pointer that starts with "#/" is treated as "/". JSON
pointers must start with "#/" or "/" to be parsed correctly.

@param pointer JSON pointer to parse.
@return Returns the parsed pointer.
@throws IllegalArgumentException if the pointer does not start with slash (/).
smithy-model/src/main/java/software/amazon/smithy/model/node/NodePointer.java