private Optional<Schema> getSchemaFromArray(List<Schema> schemaArray, String[] segments) {
        if (segments.length == 1) {
            return Optional.empty();
        }

        try {
            int position = segments[1].equals("-") ? schemaArray.size() - 1 : Integer.parseInt(segments[1]);
            return position > -1 && position < schemaArray.size()
                    ? getRecursiveSchema(Optional.of(schemaArray.get(position)), segments, 2)
                    : Optional.empty();
        } catch (NumberFormatException e) {
            throw new SmithyJsonSchemaException("Invalid JSON pointer number: " + e.getMessage());
        }
    }
Selects a nested schema using a variadic list of property names
to descend into.

<p>For example, this method can be used to get the items schema nested
inside of an array inside of an object:

<pre>{@code
Schema itemsSchema = schema.selectSchema("properties", "foo", "items").get();
}</pre>

@param segments The properties names to retrieve.
@return Returns the selected Schema.
smithy-jsonschema/src/main/java/software/amazon/smithy/jsonschema/Schema.java