class Graphql::Generators::InstallGenerator

Add GraphQL to a Rails app with rails g graphql:install.

Setup a folder structure for GraphQL:

- app/
  - graphql/
    - resolvers/
    - types/
      - base_argument.rb
      - base_field.rb
      - base_enum.rb
      - base_input_object.rb
      - base_interface.rb
      - base_object.rb
      - base_scalar.rb
      - base_union.rb
      - query_type.rb
    - loaders/
    - mutations/
      - base_mutation.rb
    - {app_name}_schema.rb

(Add .gitkeeps by default, support --skip-keeps)

Add a controller for serving GraphQL queries:

app/controllers/graphql_controller.rb

Add a route for that controller:

# config/routes.rb
post "/graphql", to: "graphql#execute"

Add ActiveRecord::QueryLogs metadata:

    current_graphql_operation: -> { GraphQL::Current.operation_name },
  current_graphql_field: -> { GraphQL::Current.field&.path },
  current_dataloader_source: -> { GraphQL::Current.dataloader_source_class },

Accept a --batch option which adds GraphQL::Batch setup.

Use --skip-graphiql to skip graphiql-rails installation.

TODO: also add base classes