graphql 1.8.13 → 1.8.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/spec/dummy/Gemfile.lock +2 -2
- data/spec/dummy/log/test.log +3 -0
- data/spec/graphql/static_validation/rules/argument_literals_are_compatible_spec.rb +3 -3
- data/spec/integration/tmp/app/graphql/types/family_type.rb +9 -0
- metadata +236 -329
- data/spec/integration/tmp/app/graphql/types/bird_type.rb +0 -7
- data/spec/integration/tmp/dummy/Gemfile +0 -45
- data/spec/integration/tmp/dummy/README.rdoc +0 -28
- data/spec/integration/tmp/dummy/Rakefile +0 -6
- data/spec/integration/tmp/dummy/app/assets/javascripts/application.js +0 -16
- data/spec/integration/tmp/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/integration/tmp/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/integration/tmp/dummy/app/controllers/graphql_controller.rb +0 -43
- data/spec/integration/tmp/dummy/app/graphql/dummy_schema.rb +0 -34
- data/spec/integration/tmp/dummy/app/graphql/types/base_enum.rb +0 -4
- data/spec/integration/tmp/dummy/app/graphql/types/base_input_object.rb +0 -4
- data/spec/integration/tmp/dummy/app/graphql/types/base_interface.rb +0 -5
- data/spec/integration/tmp/dummy/app/graphql/types/base_object.rb +0 -4
- data/spec/integration/tmp/dummy/app/graphql/types/base_scalar.rb +0 -4
- data/spec/integration/tmp/dummy/app/graphql/types/base_union.rb +0 -4
- data/spec/integration/tmp/dummy/app/graphql/types/mutation_type.rb +0 -10
- data/spec/integration/tmp/dummy/app/graphql/types/query_type.rb +0 -15
- data/spec/integration/tmp/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/integration/tmp/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/integration/tmp/dummy/bin/bundle +0 -3
- data/spec/integration/tmp/dummy/bin/rails +0 -4
- data/spec/integration/tmp/dummy/bin/rake +0 -4
- data/spec/integration/tmp/dummy/bin/setup +0 -29
- data/spec/integration/tmp/dummy/config.ru +0 -4
- data/spec/integration/tmp/dummy/config/application.rb +0 -32
- data/spec/integration/tmp/dummy/config/boot.rb +0 -3
- data/spec/integration/tmp/dummy/config/environment.rb +0 -5
- data/spec/integration/tmp/dummy/config/environments/development.rb +0 -38
- data/spec/integration/tmp/dummy/config/environments/production.rb +0 -76
- data/spec/integration/tmp/dummy/config/environments/test.rb +0 -42
- data/spec/integration/tmp/dummy/config/initializers/assets.rb +0 -11
- data/spec/integration/tmp/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/integration/tmp/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/integration/tmp/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/integration/tmp/dummy/config/initializers/inflections.rb +0 -16
- data/spec/integration/tmp/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/integration/tmp/dummy/config/initializers/session_store.rb +0 -3
- data/spec/integration/tmp/dummy/config/initializers/to_time_preserves_timezone.rb +0 -10
- data/spec/integration/tmp/dummy/config/initializers/wrap_parameters.rb +0 -9
- data/spec/integration/tmp/dummy/config/locales/en.yml +0 -23
- data/spec/integration/tmp/dummy/config/routes.rb +0 -61
- data/spec/integration/tmp/dummy/config/secrets.yml +0 -22
- data/spec/integration/tmp/dummy/db/seeds.rb +0 -7
- data/spec/integration/tmp/dummy/public/404.html +0 -67
- data/spec/integration/tmp/dummy/public/422.html +0 -67
- data/spec/integration/tmp/dummy/public/500.html +0 -66
- data/spec/integration/tmp/dummy/public/favicon.ico +0 -0
- data/spec/integration/tmp/dummy/public/robots.txt +0 -5
@@ -1,45 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
|
4
|
-
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
5
|
-
gem 'rails', '4.2.10'
|
6
|
-
# Use SCSS for stylesheets
|
7
|
-
gem 'sass-rails', '~> 5.0'
|
8
|
-
# Use Uglifier as compressor for JavaScript assets
|
9
|
-
gem 'uglifier', '>= 1.3.0'
|
10
|
-
# Use CoffeeScript for .coffee assets and views
|
11
|
-
gem 'coffee-rails', '~> 4.1.0'
|
12
|
-
# See https://github.com/rails/execjs#readme for more supported runtimes
|
13
|
-
# gem 'therubyracer', platforms: :ruby
|
14
|
-
|
15
|
-
# Use jquery as the JavaScript library
|
16
|
-
gem 'jquery-rails'
|
17
|
-
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
18
|
-
gem 'turbolinks'
|
19
|
-
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
20
|
-
gem 'jbuilder', '~> 2.0'
|
21
|
-
# bundle exec rake doc:rails generates the API under doc/api.
|
22
|
-
gem 'sdoc', '~> 0.4.0', group: :doc
|
23
|
-
|
24
|
-
# Use ActiveModel has_secure_password
|
25
|
-
# gem 'bcrypt', '~> 3.1.7'
|
26
|
-
|
27
|
-
# Use Unicorn as the app server
|
28
|
-
# gem 'unicorn'
|
29
|
-
|
30
|
-
# Use Capistrano for deployment
|
31
|
-
# gem 'capistrano-rails', group: :development
|
32
|
-
|
33
|
-
group :development, :test do
|
34
|
-
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
35
|
-
gem 'byebug'
|
36
|
-
end
|
37
|
-
|
38
|
-
group :development do
|
39
|
-
# Access an IRB console on exception pages or by using <%= console %> in views
|
40
|
-
gem 'web-console', '~> 2.0'
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
gem 'graphql-batch'
|
45
|
-
gem 'graphiql-rails', group: :development
|
@@ -1,28 +0,0 @@
|
|
1
|
-
== README
|
2
|
-
|
3
|
-
This README would normally document whatever steps are necessary to get the
|
4
|
-
application up and running.
|
5
|
-
|
6
|
-
Things you may want to cover:
|
7
|
-
|
8
|
-
* Ruby version
|
9
|
-
|
10
|
-
* System dependencies
|
11
|
-
|
12
|
-
* Configuration
|
13
|
-
|
14
|
-
* Database creation
|
15
|
-
|
16
|
-
* Database initialization
|
17
|
-
|
18
|
-
* How to run the test suite
|
19
|
-
|
20
|
-
* Services (job queues, cache servers, search engines, etc.)
|
21
|
-
|
22
|
-
* Deployment instructions
|
23
|
-
|
24
|
-
* ...
|
25
|
-
|
26
|
-
|
27
|
-
Please feel free to use a different markup language if you do not plan to run
|
28
|
-
<tt>rake doc:app</tt>.
|
@@ -1,16 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require turbolinks
|
16
|
-
//= require_tree .
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
-
* file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,43 +0,0 @@
|
|
1
|
-
class GraphqlController < ApplicationController
|
2
|
-
def execute
|
3
|
-
variables = ensure_hash(params[:variables])
|
4
|
-
query = params[:query]
|
5
|
-
operation_name = params[:operationName]
|
6
|
-
context = {
|
7
|
-
# Query context goes here, for example:
|
8
|
-
# current_user: current_user,
|
9
|
-
}
|
10
|
-
result = DummySchema.execute(query, variables: variables, context: context, operation_name: operation_name)
|
11
|
-
render json: result
|
12
|
-
rescue => e
|
13
|
-
raise e unless Rails.env.development?
|
14
|
-
handle_error_in_development e
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
# Handle form data, JSON body, or a blank value
|
20
|
-
def ensure_hash(ambiguous_param)
|
21
|
-
case ambiguous_param
|
22
|
-
when String
|
23
|
-
if ambiguous_param.present?
|
24
|
-
ensure_hash(JSON.parse(ambiguous_param))
|
25
|
-
else
|
26
|
-
{}
|
27
|
-
end
|
28
|
-
when Hash, ActionController::Parameters
|
29
|
-
ambiguous_param
|
30
|
-
when nil
|
31
|
-
{}
|
32
|
-
else
|
33
|
-
raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def handle_error_in_development(e)
|
38
|
-
logger.error e.message
|
39
|
-
logger.error e.backtrace.join("\n")
|
40
|
-
|
41
|
-
render json: { error: { message: e.message, backtrace: e.backtrace }, data: {} }, status: 500
|
42
|
-
end
|
43
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
class DummySchema < GraphQL::Schema
|
2
|
-
|
3
|
-
mutation(Types::MutationType)
|
4
|
-
query(Types::QueryType)
|
5
|
-
# Relay Object Identification:
|
6
|
-
|
7
|
-
# Return a string UUID for `object`
|
8
|
-
def self.id_from_object(object, type_definition, query_ctx)
|
9
|
-
# Here's a simple implementation which:
|
10
|
-
# - joins the type name & object.id
|
11
|
-
# - encodes it with base64:
|
12
|
-
# GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
|
13
|
-
end
|
14
|
-
|
15
|
-
# Given a string UUID, find the object
|
16
|
-
def self.object_from_id(id, query_ctx)
|
17
|
-
# For example, to decode the UUIDs generated above:
|
18
|
-
# type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
|
19
|
-
#
|
20
|
-
# Then, based on `type_name` and `id`
|
21
|
-
# find an object in your application
|
22
|
-
# ...
|
23
|
-
end
|
24
|
-
|
25
|
-
# Object Resolution
|
26
|
-
def self.resolve_type(type, obj, ctx)
|
27
|
-
# TODO: Implement this function
|
28
|
-
# to return the correct type for `obj`
|
29
|
-
raise(NotImplementedError)
|
30
|
-
end
|
31
|
-
|
32
|
-
# GraphQL::Batch setup:
|
33
|
-
use GraphQL::Batch
|
34
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Types
|
2
|
-
class QueryType < Types::BaseObject
|
3
|
-
# Add root-level fields here.
|
4
|
-
# They will be entry points for queries on your schema.
|
5
|
-
|
6
|
-
# TODO: remove me
|
7
|
-
field :test_field, String, null: false,
|
8
|
-
description: "An example field added by the generator"
|
9
|
-
def test_field
|
10
|
-
"Hello World!"
|
11
|
-
end
|
12
|
-
|
13
|
-
field :node, field: GraphQL::Relay::Node.field
|
14
|
-
end
|
15
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Dummy</title>
|
5
|
-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
# path to your application root.
|
5
|
-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
-
|
7
|
-
Dir.chdir APP_ROOT do
|
8
|
-
# This script is a starting point to setup your application.
|
9
|
-
# Add necessary setup steps to this file:
|
10
|
-
|
11
|
-
puts "== Installing dependencies =="
|
12
|
-
system "gem install bundler --conservative"
|
13
|
-
system "bundle check || bundle install"
|
14
|
-
|
15
|
-
# puts "\n== Copying sample files =="
|
16
|
-
# unless File.exist?("config/database.yml")
|
17
|
-
# system "cp config/database.yml.sample config/database.yml"
|
18
|
-
# end
|
19
|
-
|
20
|
-
puts "\n== Preparing database =="
|
21
|
-
system "bin/rake db:setup"
|
22
|
-
|
23
|
-
puts "\n== Removing old logs and tempfiles =="
|
24
|
-
system "rm -f log/*"
|
25
|
-
system "rm -rf tmp/cache"
|
26
|
-
|
27
|
-
puts "\n== Restarting application server =="
|
28
|
-
system "touch tmp/restart.txt"
|
29
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require "rails"
|
4
|
-
# Pick the frameworks you want:
|
5
|
-
require "active_model/railtie"
|
6
|
-
require "active_job/railtie"
|
7
|
-
# require "active_record/railtie"
|
8
|
-
require "action_controller/railtie"
|
9
|
-
require "action_mailer/railtie"
|
10
|
-
require "action_view/railtie"
|
11
|
-
require "sprockets/railtie"
|
12
|
-
# require "rails/test_unit/railtie"
|
13
|
-
|
14
|
-
# Require the gems listed in Gemfile, including any gems
|
15
|
-
# you've limited to :test, :development, or :production.
|
16
|
-
Bundler.require(*Rails.groups)
|
17
|
-
|
18
|
-
module Dummy
|
19
|
-
class Application < Rails::Application
|
20
|
-
# Settings in config/environments/* take precedence over those specified here.
|
21
|
-
# Application configuration should go into files in config/initializers
|
22
|
-
# -- all .rb files in that directory are automatically loaded.
|
23
|
-
|
24
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
27
|
-
|
28
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
29
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
|
-
# config.i18n.default_locale = :de
|
31
|
-
end
|
32
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Do not eager load code on boot.
|
10
|
-
config.eager_load = false
|
11
|
-
|
12
|
-
# Show full error reports and disable caching.
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send.
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger.
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
23
|
-
# This option may cause significant delays in view rendering with a large
|
24
|
-
# number of complex assets.
|
25
|
-
config.assets.debug = true
|
26
|
-
|
27
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
28
|
-
# yet still be able to expire them through the digest params.
|
29
|
-
config.assets.digest = true
|
30
|
-
|
31
|
-
# Adds additional error checking when serving assets at runtime.
|
32
|
-
# Checks for improperly declared sprockets dependencies.
|
33
|
-
# Raises helpful error messages.
|
34
|
-
config.assets.raise_runtime_errors = true
|
35
|
-
|
36
|
-
# Raises error for missing translations
|
37
|
-
# config.action_view.raise_on_missing_translations = true
|
38
|
-
end
|
@@ -1,76 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# Code is not reloaded between requests.
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Eager load code on boot. This eager loads most of Rails and
|
8
|
-
# your application in memory, allowing both threaded web servers
|
9
|
-
# and those relying on copy on write to perform better.
|
10
|
-
# Rake tasks automatically ignore this option for performance.
|
11
|
-
config.eager_load = true
|
12
|
-
|
13
|
-
# Full error reports are disabled and caching is turned on.
|
14
|
-
config.consider_all_requests_local = false
|
15
|
-
config.action_controller.perform_caching = true
|
16
|
-
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
-
# NGINX, varnish or squid.
|
21
|
-
# config.action_dispatch.rack_cache = true
|
22
|
-
|
23
|
-
# Disable serving static files from the `/public` folder by default since
|
24
|
-
# Apache or NGINX already handles this.
|
25
|
-
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
|
-
|
27
|
-
# Compress JavaScripts and CSS.
|
28
|
-
config.assets.js_compressor = :uglifier
|
29
|
-
# config.assets.css_compressor = :sass
|
30
|
-
|
31
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
|
-
config.assets.compile = false
|
33
|
-
|
34
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
35
|
-
# yet still be able to expire them through the digest params.
|
36
|
-
config.assets.digest = true
|
37
|
-
|
38
|
-
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
39
|
-
|
40
|
-
# Specifies the header that your server uses for sending files.
|
41
|
-
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
43
|
-
|
44
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
|
-
# config.force_ssl = true
|
46
|
-
|
47
|
-
# Use the lowest log level to ensure availability of diagnostic information
|
48
|
-
# when problems arise.
|
49
|
-
config.log_level = :debug
|
50
|
-
|
51
|
-
# Prepend all log lines with the following tags.
|
52
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
53
|
-
|
54
|
-
# Use a different logger for distributed setups.
|
55
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
56
|
-
|
57
|
-
# Use a different cache store in production.
|
58
|
-
# config.cache_store = :mem_cache_store
|
59
|
-
|
60
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
61
|
-
# config.action_controller.asset_host = 'http://assets.example.com'
|
62
|
-
|
63
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
64
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
65
|
-
# config.action_mailer.raise_delivery_errors = false
|
66
|
-
|
67
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
68
|
-
# the I18n.default_locale when a translation cannot be found).
|
69
|
-
config.i18n.fallbacks = true
|
70
|
-
|
71
|
-
# Send deprecation notices to registered listeners.
|
72
|
-
config.active_support.deprecation = :notify
|
73
|
-
|
74
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
75
|
-
config.log_formatter = ::Logger::Formatter.new
|
76
|
-
end
|