class JsonSchemaInspector implements Inspector {

    @Override
    public List<String> getPaths(final String kind, final String type, final String specification,
        final Optional<byte[]> exemplar) {
        final JsonSchema schema;
        try {
            schema = JsonSchemaUtils.reader().readValue(specification);
        } catch (final IOException e) {
            LOG.warn("Unable to parse the given JSON schema, increase log level to DEBUG to see the schema being parsed", e);
            LOG.debug(specification);

            return Collections.emptyList();
        }

        String context = null;
        final List<String> paths = new ArrayList<>();
        ObjectSchema objectSchema;
        if (schema.isObjectSchema()) {
            objectSchema = schema.asObjectSchema();
        } else if (schema.isArraySchema()) {
            objectSchema = getItemSchema(schema.asArraySchema());
            // add collection specific paths
            paths.addAll(COLLECTION_PATHS);
            context = ARRAY_CONTEXT;
        } else {
            throw new IllegalStateException(String.format("Unexpected schema type %s - expected object or array schema", schema.getType()));
        }

        if (objectSchema != null) {
            final Map<String, JsonSchema> properties = objectSchema.getProperties();
            fetchPaths(context, paths, properties);
        }

        return Collections.unmodifiableList(paths);
    }

}