class JsonInstanceInspector implements Inspector {

    @Override
    @SuppressWarnings("unchecked")
    public List<String> getPaths(String kind, String type, String specification, Optional<byte[]> exemplar) {
        if (specification == null) {
            return Collections.emptyList();
        }

        String context = null;
        final List<String> paths = new ArrayList<>();
        try {
            Map<String, Object> json;
            if (JsonUtils.isJsonArray(specification)) {
                List<Object> items = JsonUtils.reader().forType(List.class).readValue(specification);
                // add collection specific paths
                paths.addAll(COLLECTION_PATHS);
                context = ARRAY_CONTEXT;

                if (items.isEmpty()) {
                    return Collections.unmodifiableList(paths);
                }

                json = (Map<String, Object>) items.get(0);
            } else {
                json = JsonUtils.reader().forType(Map.class).readValue(specification);
            }

            fetchPaths(context, paths, json);
        } catch (final IOException e) {
            LOG.warn("Unable to parse the given JSON instance, increase log level to DEBUG to see the instance being parsed");
            LOG.debug(specification);
            LOG.trace("Unable to parse the given JSON instance", e);
        }

        return Collections.unmodifiableList(paths);
    }

}