graphql-rb 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +26 -0
- data/lib/graphql/configuration/configurable.rb +46 -0
- data/lib/graphql/configuration/configuration.rb +92 -0
- data/lib/graphql/configuration/slot.rb +124 -0
- data/lib/graphql/configuration.rb +3 -0
- data/lib/graphql/errors/error.rb +3 -0
- data/lib/graphql/errors.rb +1 -0
- data/lib/graphql/executor.rb +83 -0
- data/lib/graphql/introspection/meta_fields.rb +54 -0
- data/lib/graphql/introspection/query.rb +81 -0
- data/lib/graphql/introspection/schema.rb +158 -0
- data/lib/graphql/introspection.rb +3 -0
- data/lib/graphql/language/argument.rb +11 -0
- data/lib/graphql/language/directive.rb +5 -0
- data/lib/graphql/language/document.rb +23 -0
- data/lib/graphql/language/field.rb +55 -0
- data/lib/graphql/language/fragment_definition.rb +23 -0
- data/lib/graphql/language/fragment_spread.rb +5 -0
- data/lib/graphql/language/inline_fragment.rb +23 -0
- data/lib/graphql/language/list_type.rb +15 -0
- data/lib/graphql/language/name.rb +5 -0
- data/lib/graphql/language/named_type.rb +15 -0
- data/lib/graphql/language/non_null_type.rb +15 -0
- data/lib/graphql/language/operation_definition.rb +33 -0
- data/lib/graphql/language/parser.rb +331 -0
- data/lib/graphql/language/selection_set.rb +107 -0
- data/lib/graphql/language/transform.rb +101 -0
- data/lib/graphql/language/value.rb +24 -0
- data/lib/graphql/language/variable.rb +11 -0
- data/lib/graphql/language/variable_definition.rb +34 -0
- data/lib/graphql/language.rb +40 -0
- data/lib/graphql/type/argument.rb +16 -0
- data/lib/graphql/type/directive.rb +37 -0
- data/lib/graphql/type/directives.rb +25 -0
- data/lib/graphql/type/enum_type.rb +100 -0
- data/lib/graphql/type/field.rb +50 -0
- data/lib/graphql/type/input_object_type.rb +47 -0
- data/lib/graphql/type/interface_type.rb +64 -0
- data/lib/graphql/type/list.rb +23 -0
- data/lib/graphql/type/non_null.rb +25 -0
- data/lib/graphql/type/object_type.rb +57 -0
- data/lib/graphql/type/scalar_type.rb +137 -0
- data/lib/graphql/type/schema.rb +49 -0
- data/lib/graphql/type/union_type.rb +39 -0
- data/lib/graphql/type.rb +82 -0
- data/lib/graphql/validator.rb +43 -0
- data/lib/graphql/version.rb +3 -0
- data/lib/graphql.rb +21 -0
- data/spec/configuration/configuration_spec.rb +4 -0
- data/spec/data.rb +89 -0
- data/spec/introspection/full_spec.rb +12 -0
- data/spec/introspection/simple_spec.rb +153 -0
- data/spec/language/parser_spec.rb +73 -0
- data/spec/schema.rb +145 -0
- data/spec/spec_helper.rb +99 -0
- data/spec/type/enum_spec.rb +27 -0
- data/spec/type/input_object_spec.rb +21 -0
- data/spec/type/list_spec.rb +16 -0
- data/spec/type/non_null_spec.rb +22 -0
- data/spec/type/scalar_type_spec.rb +117 -0
- data/spec/type/schema_spec.rb +13 -0
- metadata +202 -0
data/spec/schema.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'graphql'
|
2
|
+
require_relative 'data'
|
3
|
+
|
4
|
+
module StarWars
|
5
|
+
|
6
|
+
EpisodeEnum = GraphQL::GraphQLEnumType.new do
|
7
|
+
name 'Episode'
|
8
|
+
description 'One of the films in the Star Wars Trilogy'
|
9
|
+
|
10
|
+
value 'NEWHOPE', 4, description: 'Released in 1977'
|
11
|
+
value 'EMPIRE', 5, description: 'Released in 1980'
|
12
|
+
value 'JEDI', 6, description: 'Released in 1983'
|
13
|
+
end
|
14
|
+
|
15
|
+
CharacterInterface = GraphQL::GraphQLInterfaceType.new do
|
16
|
+
name 'Character'
|
17
|
+
description 'A character in the Star Wars Trilogy'
|
18
|
+
|
19
|
+
field :id do
|
20
|
+
type !GraphQL::GraphQLString
|
21
|
+
description 'The id of the character'
|
22
|
+
end
|
23
|
+
|
24
|
+
field :name do
|
25
|
+
type GraphQL::GraphQLString
|
26
|
+
description 'The name of the character'
|
27
|
+
end
|
28
|
+
|
29
|
+
field :friends do
|
30
|
+
type -> { +CharacterInterface }
|
31
|
+
description 'The friends of the character, or an empty list if they have none'
|
32
|
+
end
|
33
|
+
|
34
|
+
field :appears_in do
|
35
|
+
type +EpisodeEnum
|
36
|
+
description 'Which movies they appear in'
|
37
|
+
end
|
38
|
+
|
39
|
+
resolve_type -> (object) {
|
40
|
+
case object
|
41
|
+
when StarWars::Data::Human
|
42
|
+
HumanType
|
43
|
+
when StarWars::Data::Droid
|
44
|
+
DroidType
|
45
|
+
else
|
46
|
+
raise "No type found for #{object}"
|
47
|
+
end
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
HumanType = GraphQL::GraphQLObjectType.new do
|
52
|
+
name 'Human'
|
53
|
+
description 'A humanoid creature in the Star Wars universe'
|
54
|
+
|
55
|
+
field :id, !GraphQL::GraphQLString do
|
56
|
+
description 'The id of the human'
|
57
|
+
end
|
58
|
+
|
59
|
+
field :name, GraphQL::GraphQLString, description: 'The name of the human'
|
60
|
+
|
61
|
+
field :friends, +CharacterInterface do
|
62
|
+
description 'The friends of the human, or an empty list if they have none'
|
63
|
+
|
64
|
+
resolve lambda { |root, *args|
|
65
|
+
StarWars::Data.select(root.friends)
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
field :appears_in, +EpisodeEnum, description: 'Which movies they appear in'
|
70
|
+
|
71
|
+
field :home_planet, GraphQL::GraphQLString, description: 'The home planet of the human, or null if unknown'
|
72
|
+
|
73
|
+
interface CharacterInterface
|
74
|
+
end
|
75
|
+
|
76
|
+
DroidType = GraphQL::GraphQLObjectType.new do
|
77
|
+
name 'Droid'
|
78
|
+
description 'A mechanical creature in the Star Wars universe'
|
79
|
+
|
80
|
+
field :id, !GraphQL::GraphQLString do
|
81
|
+
description 'The id of the droid'
|
82
|
+
end
|
83
|
+
|
84
|
+
field :name, GraphQL::GraphQLString, description: 'The name of the droid'
|
85
|
+
|
86
|
+
field :friends, +CharacterInterface do
|
87
|
+
description 'The friends of the droid, or an empty list if they have none'
|
88
|
+
|
89
|
+
resolve lambda { |root, *args|
|
90
|
+
StarWars::Data.select(root.friends)
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
field :appears_in, +EpisodeEnum, description: 'Which movies they appear in'
|
95
|
+
|
96
|
+
field :primary_function, GraphQL::GraphQLString, description: 'The primary function of the droid'
|
97
|
+
|
98
|
+
interface CharacterInterface
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
QueryType = GraphQL::GraphQLObjectType.new do
|
103
|
+
name 'Query'
|
104
|
+
|
105
|
+
field :hero, CharacterInterface do
|
106
|
+
arg :episode, EpisodeEnum do
|
107
|
+
description 'If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.'
|
108
|
+
end
|
109
|
+
|
110
|
+
resolve lambda { |root, params, *args|
|
111
|
+
if params[:episode] == 6
|
112
|
+
return StarWars::Data::get('1000')
|
113
|
+
else
|
114
|
+
return StarWars::Data::get('2000')
|
115
|
+
end
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
field :human, HumanType do
|
120
|
+
arg :id, !GraphQL::GraphQLString, description: 'Id of the human'
|
121
|
+
|
122
|
+
resolve lambda { |root, params, *args|
|
123
|
+
raise "Not implemented. Yet."
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
field :driod, DroidType do
|
128
|
+
arg :id, !GraphQL::GraphQLString, description: 'Id of the droid'
|
129
|
+
|
130
|
+
resolve lambda { |root, params, *args|
|
131
|
+
raise "Not implemented. Yet."
|
132
|
+
}
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
Schema = GraphQL::GraphQLSchema.new do
|
138
|
+
|
139
|
+
name 'StarWars'
|
140
|
+
|
141
|
+
query QueryType
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'codeclimate-test-reporter'
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
|
4
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
6
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
7
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
8
|
+
# files.
|
9
|
+
#
|
10
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
11
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
12
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
13
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
14
|
+
# a separate helper file that requires the additional dependencies and performs
|
15
|
+
# the additional setup, and require it from the spec files that actually need
|
16
|
+
# it.
|
17
|
+
#
|
18
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
19
|
+
# users commonly want.
|
20
|
+
#
|
21
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
22
|
+
RSpec.configure do |config|
|
23
|
+
# rspec-expectations config goes here. You can use an alternate
|
24
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
25
|
+
# assertions if you prefer.
|
26
|
+
config.expect_with :rspec do |expectations|
|
27
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
28
|
+
# and `failure_message` of custom matchers include text for helper methods
|
29
|
+
# defined using `chain`, e.g.:
|
30
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
31
|
+
# # => 'be bigger than 2 and smaller than 4'
|
32
|
+
# ...rather than:
|
33
|
+
# # => 'be bigger than 2'
|
34
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
35
|
+
end
|
36
|
+
|
37
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
38
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
39
|
+
config.mock_with :rspec do |mocks|
|
40
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
41
|
+
# a real object. This is generally recommended, and will default to
|
42
|
+
# `true` in RSpec 4.
|
43
|
+
mocks.verify_partial_doubles = true
|
44
|
+
end
|
45
|
+
|
46
|
+
# The settings below are suggested to provide a good initial experience
|
47
|
+
# with RSpec, but feel free to customize to your heart's content.
|
48
|
+
=begin
|
49
|
+
# These two settings work together to allow you to limit a spec run
|
50
|
+
# to individual examples or groups you care about by tagging them with
|
51
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
52
|
+
# get run.
|
53
|
+
config.filter_run :focus
|
54
|
+
config.run_all_when_everything_filtered = true
|
55
|
+
|
56
|
+
# Allows RSpec to persist some state between runs in order to support
|
57
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
58
|
+
# you configure your source control system to ignore this file.
|
59
|
+
config.example_status_persistence_file_path = 'spec/examples.txt'
|
60
|
+
|
61
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
62
|
+
# recommended. For more details, see:
|
63
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
64
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
65
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
66
|
+
config.disable_monkey_patching!
|
67
|
+
|
68
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
69
|
+
# be too noisy due to issues in dependencies.
|
70
|
+
config.warnings = true
|
71
|
+
|
72
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
73
|
+
# file, and it's useful to allow more verbose output when running an
|
74
|
+
# individual spec file.
|
75
|
+
if config.files_to_run.one?
|
76
|
+
# Use the documentation formatter for detailed output,
|
77
|
+
# unless a formatter has already been configured
|
78
|
+
# (e.g. via a command-line flag).
|
79
|
+
config.default_formatter = 'doc'
|
80
|
+
end
|
81
|
+
|
82
|
+
# Print the 10 slowest examples and example groups at the
|
83
|
+
# end of the spec run, to help surface which specs are running
|
84
|
+
# particularly slow.
|
85
|
+
config.profile_examples = 10
|
86
|
+
|
87
|
+
# Run specs in random order to surface order dependencies. If you find an
|
88
|
+
# order dependency and want to debug it, you can fix the order by providing
|
89
|
+
# the seed, which is printed after each run.
|
90
|
+
# --seed 1234
|
91
|
+
config.order = :random
|
92
|
+
|
93
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
94
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
95
|
+
# test failures related to randomization by passing the same `--seed` value
|
96
|
+
# as the one that triggered the failure.
|
97
|
+
Kernel.srand config.seed
|
98
|
+
=end
|
99
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'graphql'
|
2
|
+
|
3
|
+
RSpec.describe GraphQL::GraphQLEnumType do
|
4
|
+
|
5
|
+
def type(*args, &block)
|
6
|
+
GraphQL::GraphQLEnumType.new(*args, &block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def rgb_type
|
10
|
+
@rgb_type ||= type do
|
11
|
+
name 'RGB'
|
12
|
+
value :RED, 1
|
13
|
+
value :GREEN, 2
|
14
|
+
value :BLUE
|
15
|
+
value :ALPHA, description: 'Alpha channel'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "Should create RGB Enum" do
|
20
|
+
expect { rgb_type }.not_to raise_error
|
21
|
+
expect(rgb_type.serialize(1)).to eql('RED')
|
22
|
+
expect(rgb_type.serialize('BLUE')).to eql('BLUE')
|
23
|
+
expect(rgb_type.parse_value('GREEN')).to eql(2)
|
24
|
+
expect(rgb_type.parse_literal(kind: :enum, value: 'GREEN')).to eql(2)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'graphql'
|
2
|
+
|
3
|
+
RSpec.describe GraphQL::GraphQLInputObjectType do
|
4
|
+
|
5
|
+
|
6
|
+
def input_type
|
7
|
+
@input_type ||= GraphQL::GraphQLInputObjectType.new do
|
8
|
+
name 'GeoPoint'
|
9
|
+
|
10
|
+
field 'lat', GraphQL::GraphQLNonNull.new(GraphQL::GraphQLFloat)
|
11
|
+
field 'lon', GraphQL::GraphQLNonNull.new(GraphQL::GraphQLFloat)
|
12
|
+
field 'alt', GraphQL::GraphQLFloat, default_value: 0
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
it "Should create input type" do
|
18
|
+
expect { input_type }.not_to raise_error
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'graphql'
|
2
|
+
|
3
|
+
RSpec.describe GraphQL::GraphQLList do
|
4
|
+
|
5
|
+
it 'Should create' do
|
6
|
+
expect {
|
7
|
+
GraphQL::GraphQLList.new(GraphQL::GraphQLString)
|
8
|
+
}.not_to raise_error
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'Should convert instance to string' do
|
12
|
+
listType = GraphQL::GraphQLList.new(GraphQL::GraphQLString)
|
13
|
+
expect(listType.to_s).to eql('[String]')
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'graphql'
|
2
|
+
|
3
|
+
RSpec.describe GraphQL::GraphQLNonNull do
|
4
|
+
|
5
|
+
it 'Should create instance' do
|
6
|
+
expect {
|
7
|
+
GraphQL::GraphQLNonNull.new(GraphQL::GraphQLString)
|
8
|
+
}.not_to raise_error
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'Should not create instance' do
|
12
|
+
expect {
|
13
|
+
GraphQL::GraphQLNonNull.new(GraphQL::GraphQLNonNull.new(GraphQL::GraphQLString))
|
14
|
+
}.to raise_error(GraphQL::GraphQLNonNull::NESTING_ERROR)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'Should convert instance to string' do
|
18
|
+
nonNullType = GraphQL::GraphQLNonNull.new(GraphQL::GraphQLString)
|
19
|
+
expect(nonNullType.to_s).to eql('String!')
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'graphql'
|
2
|
+
|
3
|
+
RSpec.describe GraphQL::GraphQLScalarType do
|
4
|
+
|
5
|
+
def valid_scalar
|
6
|
+
GraphQL::GraphQLScalarType.new do
|
7
|
+
name 'String Scalar'
|
8
|
+
description 'String Scalar Description'
|
9
|
+
serialize -> (value) { value.to_s }
|
10
|
+
parse_literal -> (value) { raise 'Not implemented' }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def invalid_scalar
|
15
|
+
GraphQL::GraphQLScalarType.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def string
|
19
|
+
GraphQL::GraphQLString
|
20
|
+
end
|
21
|
+
|
22
|
+
def int
|
23
|
+
GraphQL::GraphQLInt
|
24
|
+
end
|
25
|
+
|
26
|
+
def float
|
27
|
+
GraphQL::GraphQLFloat
|
28
|
+
end
|
29
|
+
|
30
|
+
def boolean
|
31
|
+
GraphQL::GraphQLBoolean
|
32
|
+
end
|
33
|
+
|
34
|
+
def id
|
35
|
+
GraphQL::GraphQLID
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'Should perform to_s' do
|
39
|
+
expect(valid_scalar.to_s).to eql(valid_scalar.name)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'Should coerce' do
|
43
|
+
expect(valid_scalar.serialize('ABC')).to eql('ABC')
|
44
|
+
expect(valid_scalar.serialize(123)).to eql('123')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'Should not coerce' do
|
48
|
+
expect { valid_scalar.parse_literal('ABC') }.to raise_error('Not implemented')
|
49
|
+
end
|
50
|
+
|
51
|
+
# Int
|
52
|
+
#
|
53
|
+
it 'Should coerce value to int' do
|
54
|
+
expect(int.serialize('123')).to eql(123)
|
55
|
+
expect(int.serialize(123.45)).to eql(123)
|
56
|
+
expect(int.serialize(123.5)).to eql(124)
|
57
|
+
expect(int.serialize(-123.5)).to eql(-124)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'Should not coerce value to int' do
|
61
|
+
expect(int.serialize('abc')).to eql(nil)
|
62
|
+
expect(int.parse_literal(kind: :string, value: '123')).not_to eql(123)
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
# Float
|
67
|
+
#
|
68
|
+
it 'Should coerce value to float' do
|
69
|
+
expect(float.serialize('123')).to eql(123.0)
|
70
|
+
expect(float.serialize(123)).to eql(123.0)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'Should not coerce value to float' do
|
74
|
+
expect(float.serialize('abc')).to eql(nil)
|
75
|
+
expect(float.parse_literal(kind: :string, value: '123')).not_to eql(123)
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
# String
|
80
|
+
#
|
81
|
+
it 'Should coerce value to string' do
|
82
|
+
expect(string.serialize('abc')).to eql('abc')
|
83
|
+
expect(string.serialize(:abc)).to eql('abc')
|
84
|
+
expect(string.serialize(123)).to eql('123')
|
85
|
+
expect(string.serialize(123.45)).to eql('123.45')
|
86
|
+
expect(string.serialize(true)).to eql('true')
|
87
|
+
|
88
|
+
expect(string.parse_literal(kind: :string, value: 'abc')).to eql('abc')
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'Should not coerce value to string' do
|
92
|
+
expect(string.parse_literal(kind: :int, value: 123)).to eql(nil)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Boolean
|
96
|
+
#
|
97
|
+
it 'Should coerce value to boolean' do
|
98
|
+
expect(boolean.serialize('true')).to eql(true)
|
99
|
+
expect(boolean.serialize(0)).to eql(false)
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'Should not coerce value to boolean' do
|
103
|
+
expect(boolean.parse_literal(kind: :string, value: '123')).not_to eql(123)
|
104
|
+
end
|
105
|
+
|
106
|
+
# ID
|
107
|
+
#
|
108
|
+
it 'Should coerce value to id' do
|
109
|
+
expect(id.serialize(123)).to eql('123')
|
110
|
+
expect(id.serialize('abc')).to eql('abc')
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'Should not coerce value to id' do
|
114
|
+
expect(boolean.parse_literal(kind: :string, value: '123')).not_to eql(123)
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'graphql'
|
2
|
+
require_relative '../schema'
|
3
|
+
|
4
|
+
RSpec.describe GraphQL::GraphQLSchema do
|
5
|
+
|
6
|
+
it "Should have query and shouldn't have mutation" do
|
7
|
+
expect(StarWars::Schema.query_type).not_to eql(nil)
|
8
|
+
expect(StarWars::Schema.mutation_type).to eql(nil)
|
9
|
+
|
10
|
+
puts StarWars::Schema.type_map.keys.inspect
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: graphql-rb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eugene Kovalev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: codeclimate-test-reporter
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: awesome_print
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: parslet
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: celluloid
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Description of GraphQL.
|
98
|
+
email:
|
99
|
+
- seanchas@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- Rakefile
|
105
|
+
- lib/graphql.rb
|
106
|
+
- lib/graphql/configuration.rb
|
107
|
+
- lib/graphql/configuration/configurable.rb
|
108
|
+
- lib/graphql/configuration/configuration.rb
|
109
|
+
- lib/graphql/configuration/slot.rb
|
110
|
+
- lib/graphql/errors.rb
|
111
|
+
- lib/graphql/errors/error.rb
|
112
|
+
- lib/graphql/executor.rb
|
113
|
+
- lib/graphql/introspection.rb
|
114
|
+
- lib/graphql/introspection/meta_fields.rb
|
115
|
+
- lib/graphql/introspection/query.rb
|
116
|
+
- lib/graphql/introspection/schema.rb
|
117
|
+
- lib/graphql/language.rb
|
118
|
+
- lib/graphql/language/argument.rb
|
119
|
+
- lib/graphql/language/directive.rb
|
120
|
+
- lib/graphql/language/document.rb
|
121
|
+
- lib/graphql/language/field.rb
|
122
|
+
- lib/graphql/language/fragment_definition.rb
|
123
|
+
- lib/graphql/language/fragment_spread.rb
|
124
|
+
- lib/graphql/language/inline_fragment.rb
|
125
|
+
- lib/graphql/language/list_type.rb
|
126
|
+
- lib/graphql/language/name.rb
|
127
|
+
- lib/graphql/language/named_type.rb
|
128
|
+
- lib/graphql/language/non_null_type.rb
|
129
|
+
- lib/graphql/language/operation_definition.rb
|
130
|
+
- lib/graphql/language/parser.rb
|
131
|
+
- lib/graphql/language/selection_set.rb
|
132
|
+
- lib/graphql/language/transform.rb
|
133
|
+
- lib/graphql/language/value.rb
|
134
|
+
- lib/graphql/language/variable.rb
|
135
|
+
- lib/graphql/language/variable_definition.rb
|
136
|
+
- lib/graphql/type.rb
|
137
|
+
- lib/graphql/type/argument.rb
|
138
|
+
- lib/graphql/type/directive.rb
|
139
|
+
- lib/graphql/type/directives.rb
|
140
|
+
- lib/graphql/type/enum_type.rb
|
141
|
+
- lib/graphql/type/field.rb
|
142
|
+
- lib/graphql/type/input_object_type.rb
|
143
|
+
- lib/graphql/type/interface_type.rb
|
144
|
+
- lib/graphql/type/list.rb
|
145
|
+
- lib/graphql/type/non_null.rb
|
146
|
+
- lib/graphql/type/object_type.rb
|
147
|
+
- lib/graphql/type/scalar_type.rb
|
148
|
+
- lib/graphql/type/schema.rb
|
149
|
+
- lib/graphql/type/union_type.rb
|
150
|
+
- lib/graphql/validator.rb
|
151
|
+
- lib/graphql/version.rb
|
152
|
+
- spec/configuration/configuration_spec.rb
|
153
|
+
- spec/data.rb
|
154
|
+
- spec/introspection/full_spec.rb
|
155
|
+
- spec/introspection/simple_spec.rb
|
156
|
+
- spec/language/parser_spec.rb
|
157
|
+
- spec/schema.rb
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
- spec/type/enum_spec.rb
|
160
|
+
- spec/type/input_object_spec.rb
|
161
|
+
- spec/type/list_spec.rb
|
162
|
+
- spec/type/non_null_spec.rb
|
163
|
+
- spec/type/scalar_type_spec.rb
|
164
|
+
- spec/type/schema_spec.rb
|
165
|
+
homepage: https://github.com/seanchas/graphql-rb
|
166
|
+
licenses:
|
167
|
+
- MIT
|
168
|
+
metadata: {}
|
169
|
+
post_install_message:
|
170
|
+
rdoc_options: []
|
171
|
+
require_paths:
|
172
|
+
- lib
|
173
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
requirements: []
|
184
|
+
rubyforge_project:
|
185
|
+
rubygems_version: 2.4.5
|
186
|
+
signing_key:
|
187
|
+
specification_version: 4
|
188
|
+
summary: Summary of GraphQL.
|
189
|
+
test_files:
|
190
|
+
- spec/configuration/configuration_spec.rb
|
191
|
+
- spec/data.rb
|
192
|
+
- spec/introspection/full_spec.rb
|
193
|
+
- spec/introspection/simple_spec.rb
|
194
|
+
- spec/language/parser_spec.rb
|
195
|
+
- spec/schema.rb
|
196
|
+
- spec/spec_helper.rb
|
197
|
+
- spec/type/enum_spec.rb
|
198
|
+
- spec/type/input_object_spec.rb
|
199
|
+
- spec/type/list_spec.rb
|
200
|
+
- spec/type/non_null_spec.rb
|
201
|
+
- spec/type/scalar_type_spec.rb
|
202
|
+
- spec/type/schema_spec.rb
|