// Path: graphql-rest/src/main/java/org/objectstyle/graphql/rest/GraphQLFeature.java
// public class GraphQLFeature implements Feature {
// 
//     private GraphQL graphQL;
//     private JacksonReaderWriter jacksonReaderWriter;
// 
//     @Override
//     public boolean configure(FeatureContext context) {
//         context.register(MessageResponseWriter.class);
//         context.register(GraphQLRestExceptionMapper.class);
//         context.register(GraphQLRestQueryReader.class);
//         context.register(ExecutionResultWriter.class);
//         context.register(GraphQLResource.class);
// 
//         context.property(GraphQL.class.getName(), graphQL);
//         context.property(JacksonReaderWriter.class.getName(), jacksonReaderWriter);
// 
//         return true;
//     }
// 
//     public static Builder newBuilder() {
//         return new Builder();
//     }
// 
//     public static class Builder {
//         private GraphQLFeature graphQLFeature;
// 
// 
//         private Builder() {
//             this.graphQLFeature = new GraphQLFeature();
//         }
// 
//         public Builder graphQL(GraphQL graphQL) {
//             graphQLFeature.graphQL = graphQL;
//             return this;
//         }
// 
//         public Builder jacksonReaderWriter(JacksonReaderWriter jacksonReaderWriter) {
//             graphQLFeature.jacksonReaderWriter = jacksonReaderWriter;
//             return this;
//         }
// 
//         public GraphQLFeature build() {
//             return graphQLFeature;
//         }
//     }
// }
// 
// Path: graphql-rest/src/main/java/org/objectstyle/graphql/rest/json/JacksonReaderWriter.java
// public class JacksonReaderWriter implements JsonReader, JsonWriter {
// 
//     private ObjectMapper sharedMapper;
//     private JsonFactory sharedFactory;
// 
//     public JacksonReaderWriter() {
// 
//         // fun Jackson API with circular dependencies ... so we create a mapper
//         // first, and grab implicitly created factory from it
//         this.sharedMapper = new ObjectMapper();
//         this.sharedFactory = sharedMapper.getFactory();
// 
//         // make sure mapper does not attempt closing streams it does not
//         // manage... why is this even a default in jackson?
//         sharedFactory.disable(Feature.AUTO_CLOSE_TARGET);
// 
//         // do not flush every time. why would we want to do that?
//         // this is having a HUGE impact on extrest serializers (5x speedup)
//         sharedMapper.disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE);
//     }
// 
//     private JsonNode parseJson(InputStream jsonStream) {
//         Objects.requireNonNull(jsonStream);
// 
//         try {
//             com.fasterxml.jackson.core.JsonParser parser = sharedFactory.createParser(jsonStream);
//             return new ObjectMapper().readTree(parser);
//         } catch (IOException e) {
//             throw new GraphQLRestException(Status.BAD_REQUEST, "Error parsing JSON", e);
//         }
//     }
// 
//     @Override
//     public <T> T read(Class<T> type, InputStream jsonStream) {
//         JsonNode jsonNode = parseJson(jsonStream);
//         try {
//             return new ObjectMapper().readValue(new TreeTraversingParser(jsonNode), type);
//         } catch (IOException e) {
//             throw new GraphQLRestException(Status.BAD_REQUEST, "Error mapping JSON to object", e);
//         }
//     }
// 
//     @Override
//     public void write(OutputStream out, JacksonWriterDelegate delegate) {
//         // TODO: UTF-8 is hardcoded...
//         try (JsonGenerator generator = sharedFactory.createGenerator(out, JsonEncoding.UTF8)) {
//             delegate.write(generator);
//         } catch (IOException e) {
//             throw new GraphQLRestException(Status.INTERNAL_SERVER_ERROR, "Error writing JSON", e);
//         }
//     }
// 
// }


import com.google.inject.Inject;
import com.google.inject.Provider;
import graphql.GraphQL;
import org.objectstyle.graphql.rest.GraphQLFeature;
import org.objectstyle.graphql.rest.json.JacksonReaderWriter;
package org.objectstyle.graphql.bootique;


class GraphQLFeatureProvider implements Provider<GraphQLFeature> {
    @Inject
    private GraphQL graphQL;

    @Inject
// Path: graphql-rest/src/main/java/org/objectstyle/graphql/rest/GraphQLFeature.java
// public class GraphQLFeature implements Feature {
// 
//     private GraphQL graphQL;
//     private JacksonReaderWriter jacksonReaderWriter;
// 
//     @Override
//     public boolean configure(FeatureContext context) {
//         context.register(MessageResponseWriter.class);
//         context.register(GraphQLRestExceptionMapper.class);
//         context.register(GraphQLRestQueryReader.class);
//         context.register(ExecutionResultWriter.class);
//         context.register(GraphQLResource.class);
// 
//         context.property(GraphQL.class.getName(), graphQL);
//         context.property(JacksonReaderWriter.class.getName(), jacksonReaderWriter);
// 
//         return true;
//     }
// 
//     public static Builder newBuilder() {
//         return new Builder();
//     }
// 
//     public static class Builder {
//         private GraphQLFeature graphQLFeature;
// 
// 
//         private Builder() {
//             this.graphQLFeature = new GraphQLFeature();
//         }
// 
//         public Builder graphQL(GraphQL graphQL) {
//             graphQLFeature.graphQL = graphQL;
//             return this;
//         }
// 
//         public Builder jacksonReaderWriter(JacksonReaderWriter jacksonReaderWriter) {
//             graphQLFeature.jacksonReaderWriter = jacksonReaderWriter;
//             return this;
//         }
// 
//         public GraphQLFeature build() {
//             return graphQLFeature;
//         }
//     }
// }
// 
// Path: graphql-rest/src/main/java/org/objectstyle/graphql/rest/json/JacksonReaderWriter.java
// public class JacksonReaderWriter implements JsonReader, JsonWriter {
// 
//     private ObjectMapper sharedMapper;
//     private JsonFactory sharedFactory;
// 
//     public JacksonReaderWriter() {
// 
//         // fun Jackson API with circular dependencies ... so we create a mapper
//         // first, and grab implicitly created factory from it
//         this.sharedMapper = new ObjectMapper();
//         this.sharedFactory = sharedMapper.getFactory();
// 
//         // make sure mapper does not attempt closing streams it does not
//         // manage... why is this even a default in jackson?
//         sharedFactory.disable(Feature.AUTO_CLOSE_TARGET);
// 
//         // do not flush every time. why would we want to do that?
//         // this is having a HUGE impact on extrest serializers (5x speedup)
//         sharedMapper.disable(SerializationFeature.FLUSH_AFTER_WRITE_VALUE);
//     }
// 
//     private JsonNode parseJson(InputStream jsonStream) {
//         Objects.requireNonNull(jsonStream);
// 
//         try {
//             com.fasterxml.jackson.core.JsonParser parser = sharedFactory.createParser(jsonStream);
//             return new ObjectMapper().readTree(parser);
//         } catch (IOException e) {
//             throw new GraphQLRestException(Status.BAD_REQUEST, "Error parsing JSON", e);
//         }
//     }
// 
//     @Override
//     public <T> T read(Class<T> type, InputStream jsonStream) {
//         JsonNode jsonNode = parseJson(jsonStream);
//         try {
//             return new ObjectMapper().readValue(new TreeTraversingParser(jsonNode), type);
//         } catch (IOException e) {
//             throw new GraphQLRestException(Status.BAD_REQUEST, "Error mapping JSON to object", e);
//         }
//     }
// 
//     @Override
//     public void write(OutputStream out, JacksonWriterDelegate delegate) {
//         // TODO: UTF-8 is hardcoded...
//         try (JsonGenerator generator = sharedFactory.createGenerator(out, JsonEncoding.UTF8)) {
//             delegate.write(generator);
//         } catch (IOException e) {
//             throw new GraphQLRestException(Status.INTERNAL_SERVER_ERROR, "Error writing JSON", e);
//         }
//     }
// 
// }


// Path: graphql-bootique/src/main/java/org/objectstyle/graphql/bootique/GraphQLFeatureProvider.java
import com.google.inject.Inject;
import com.google.inject.Provider;
import graphql.GraphQL;
import org.objectstyle.graphql.rest.GraphQLFeature;
import org.objectstyle.graphql.rest.json.JacksonReaderWriter;

package org.objectstyle.graphql.bootique;


class GraphQLFeatureProvider implements Provider<GraphQLFeature> {
    @Inject
    private GraphQL graphQL;

    @Inject
    private JacksonReaderWriter jacksonReaderWriter;