graphql 0.19.0 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql.rb +1 -0
- data/lib/graphql/base_type.rb +0 -42
- data/lib/graphql/define/instance_definable.rb +27 -14
- data/lib/graphql/interface_type.rb +1 -2
- data/lib/graphql/invalid_null_error.rb +3 -2
- data/lib/graphql/language/lexer.rl +1 -1
- data/lib/graphql/language/parser.rb +544 -531
- data/lib/graphql/language/parser.y +1 -0
- data/lib/graphql/language/parser_tests.rb +1 -1
- data/lib/graphql/object_type.rb +0 -21
- data/lib/graphql/query/serial_execution/value_resolution.rb +5 -6
- data/lib/graphql/relay/node.rb +6 -1
- data/lib/graphql/schema.rb +30 -10
- data/lib/graphql/schema/loader.rb +5 -1
- data/lib/graphql/schema/validation.rb +31 -0
- data/lib/graphql/union_type.rb +0 -1
- data/lib/graphql/unresolved_type_error.rb +16 -0
- data/lib/graphql/version.rb +1 -1
- data/spec/graphql/analysis/query_complexity_spec.rb +5 -1
- data/spec/graphql/define/instance_definable_spec.rb +11 -0
- data/spec/graphql/field_spec.rb +3 -2
- data/spec/graphql/non_null_type_spec.rb +2 -2
- data/spec/graphql/query/context_spec.rb +1 -0
- data/spec/graphql/query/executor_spec.rb +2 -2
- data/spec/graphql/query/serial_execution/value_resolution_spec.rb +49 -9
- data/spec/graphql/schema/loader_spec.rb +6 -1
- data/spec/graphql/schema/printer_spec.rb +1 -1
- data/spec/graphql/schema_spec.rb +56 -0
- data/spec/graphql/static_validation/rules/mutation_root_exists_spec.rb +1 -1
- data/spec/graphql/static_validation/rules/subscription_root_exists_spec.rb +1 -1
- data/spec/support/dairy_app.rb +0 -5
- metadata +3 -2
@@ -106,7 +106,12 @@ describe GraphQL::Schema::Loader do
|
|
106
106
|
field :ping, field: ping_mutation.field
|
107
107
|
end
|
108
108
|
|
109
|
-
GraphQL::Schema.define(
|
109
|
+
GraphQL::Schema.define(
|
110
|
+
query: query_root,
|
111
|
+
mutation: mutation_root,
|
112
|
+
orphan_types: [audio_type, video_type],
|
113
|
+
resolve_type: :pass,
|
114
|
+
)
|
110
115
|
}
|
111
116
|
|
112
117
|
let(:schema_json) {
|
data/spec/graphql/schema_spec.rb
CHANGED
@@ -47,6 +47,25 @@ describe GraphQL::Schema do
|
|
47
47
|
}
|
48
48
|
end
|
49
49
|
end
|
50
|
+
|
51
|
+
describe "when a schema is defined with abstract types, but no resolve type hook" do
|
52
|
+
it "raises not implemented" do
|
53
|
+
interface = GraphQL::InterfaceType.define do
|
54
|
+
name "SomeInterface"
|
55
|
+
end
|
56
|
+
|
57
|
+
query_type = GraphQL::ObjectType.define do
|
58
|
+
name "Query"
|
59
|
+
field :something, interface
|
60
|
+
end
|
61
|
+
|
62
|
+
assert_raises(NotImplementedError) {
|
63
|
+
GraphQL::Schema.define do
|
64
|
+
query(query_type)
|
65
|
+
end
|
66
|
+
}
|
67
|
+
end
|
68
|
+
end
|
50
69
|
end
|
51
70
|
|
52
71
|
describe "object_from_id" do
|
@@ -57,6 +76,27 @@ describe GraphQL::Schema do
|
|
57
76
|
}
|
58
77
|
end
|
59
78
|
end
|
79
|
+
|
80
|
+
describe "when a schema is defined with a relay ID field, but no hook" do
|
81
|
+
it "raises not implemented" do
|
82
|
+
thing_type = GraphQL::ObjectType.define do
|
83
|
+
name "Thing"
|
84
|
+
global_id_field :id
|
85
|
+
end
|
86
|
+
|
87
|
+
query_type = GraphQL::ObjectType.define do
|
88
|
+
name "Query"
|
89
|
+
field :thing, thing_type
|
90
|
+
end
|
91
|
+
|
92
|
+
assert_raises(NotImplementedError) {
|
93
|
+
GraphQL::Schema.define do
|
94
|
+
query(query_type)
|
95
|
+
resolve_type -> (obj, ctx) { :whatever }
|
96
|
+
end
|
97
|
+
}
|
98
|
+
end
|
99
|
+
end
|
60
100
|
end
|
61
101
|
|
62
102
|
describe "id_from_object" do
|
@@ -67,5 +107,21 @@ describe GraphQL::Schema do
|
|
67
107
|
}
|
68
108
|
end
|
69
109
|
end
|
110
|
+
|
111
|
+
describe "when a schema is defined with a node field, but no hook" do
|
112
|
+
it "raises not implemented" do
|
113
|
+
query_type = GraphQL::ObjectType.define do
|
114
|
+
name "Query"
|
115
|
+
field :node, GraphQL::Relay::Node.field
|
116
|
+
end
|
117
|
+
|
118
|
+
assert_raises(NotImplementedError) {
|
119
|
+
GraphQL::Schema.define do
|
120
|
+
query(query_type)
|
121
|
+
resolve_type -> (obj, ctx) { :whatever }
|
122
|
+
end
|
123
|
+
}
|
124
|
+
end
|
125
|
+
end
|
70
126
|
end
|
71
127
|
end
|
data/spec/support/dairy_app.rb
CHANGED
@@ -9,11 +9,6 @@ LocalProductInterface = GraphQL::InterfaceType.define do
|
|
9
9
|
name "LocalProduct"
|
10
10
|
description "Something that comes from somewhere"
|
11
11
|
field :origin, !types.String, "Place the thing comes from"
|
12
|
-
# This is a "bug" in the dummy app:
|
13
|
-
# it should actually check the incoming object to determine the type.
|
14
|
-
# But this is here so we can check _where_ misbehaving resolve_type
|
15
|
-
# functions wreak their havoc.
|
16
|
-
resolve_type -> (o, c) { MilkType }
|
17
12
|
end
|
18
13
|
|
19
14
|
EdibleInterface = GraphQL::InterfaceType.define do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codeclimate-test-reporter
|
@@ -435,6 +435,7 @@ files:
|
|
435
435
|
- lib/graphql/string_type.rb
|
436
436
|
- lib/graphql/type_kinds.rb
|
437
437
|
- lib/graphql/union_type.rb
|
438
|
+
- lib/graphql/unresolved_type_error.rb
|
438
439
|
- lib/graphql/version.rb
|
439
440
|
- readme.md
|
440
441
|
- spec/graphql/analysis/analyze_query_spec.rb
|