graphql 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql/define/assign_enum_value.rb +1 -1
  3. data/lib/graphql/execution/directive_checks.rb +5 -5
  4. data/lib/graphql/internal_representation.rb +1 -0
  5. data/lib/graphql/internal_representation/node.rb +117 -16
  6. data/lib/graphql/internal_representation/rewrite.rb +39 -94
  7. data/lib/graphql/internal_representation/scope.rb +88 -0
  8. data/lib/graphql/introspection/schema_field.rb +5 -10
  9. data/lib/graphql/introspection/type_by_name_field.rb +8 -13
  10. data/lib/graphql/introspection/typename_field.rb +5 -10
  11. data/lib/graphql/query.rb +24 -155
  12. data/lib/graphql/query/arguments_cache.rb +25 -0
  13. data/lib/graphql/query/validation_pipeline.rb +114 -0
  14. data/lib/graphql/query/variables.rb +18 -14
  15. data/lib/graphql/schema.rb +4 -3
  16. data/lib/graphql/schema/mask.rb +55 -0
  17. data/lib/graphql/schema/possible_types.rb +2 -2
  18. data/lib/graphql/schema/type_expression.rb +19 -4
  19. data/lib/graphql/schema/warden.rb +1 -3
  20. data/lib/graphql/static_validation/rules/fields_will_merge.rb +3 -2
  21. data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +4 -2
  22. data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +3 -1
  23. data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +1 -20
  24. data/lib/graphql/static_validation/validation_context.rb +6 -18
  25. data/lib/graphql/version.rb +1 -1
  26. data/spec/graphql/enum_type_spec.rb +12 -0
  27. data/spec/graphql/internal_representation/rewrite_spec.rb +26 -5
  28. data/spec/graphql/query_spec.rb +23 -3
  29. data/spec/graphql/static_validation/rules/fields_will_merge_spec.rb +2 -2
  30. data/spec/graphql/static_validation/rules/variable_default_values_are_correctly_typed_spec.rb +12 -0
  31. data/spec/graphql/static_validation/rules/variables_are_input_types_spec.rb +14 -0
  32. metadata +6 -2
@@ -45,6 +45,18 @@ describe GraphQL::StaticValidation::VariableDefaultValuesAreCorrectlyTyped do
45
45
  assert_equal(expected, errors)
46
46
  end
47
47
 
48
+ it "returns a client error when the type isn't found" do
49
+ res = schema.execute <<-GRAPHQL
50
+ query GetCheese($msg: IDX = 1) {
51
+ cheese(id: $msg) @skip(if: true) { flavor }
52
+ }
53
+ GRAPHQL
54
+
55
+ assert_equal false, res.key?("data")
56
+ assert_equal 1, res["errors"].length
57
+ assert_equal "IDX isn't a defined input type (on $msg)", res["errors"][0]["message"]
58
+ end
59
+
48
60
  describe "null default values" do
49
61
  describe "variables with valid default null values" do
50
62
  let(:schema) {
@@ -56,5 +56,19 @@ describe GraphQL::StaticValidation::VariablesAreInputTypes do
56
56
  assert_equal 1, res["errors"].length
57
57
  assert_equal "IDX isn't a defined input type (on $id)", res["errors"][0]["message"]
58
58
  end
59
+
60
+ it "returns a client error when there are directives" do
61
+ res = schema.execute <<-GRAPHQL
62
+ query GetCheese($msg: IDX) {
63
+ cheese(id: $id) @skip(if: true) { flavor }
64
+ }
65
+ GRAPHQL
66
+
67
+ assert_equal false, res.key?("data")
68
+ assert_equal 3, res["errors"].length
69
+ assert_equal "IDX isn't a defined input type (on $msg)", res["errors"][0]["message"]
70
+ assert_equal "Variable $msg is declared by GetCheese but not used", res["errors"][1]["message"]
71
+ assert_equal "Variable $id is used by GetCheese but not declared", res["errors"][2]["message"]
72
+ end
59
73
  end
60
74
  end
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: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-20 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -378,6 +378,7 @@ files:
378
378
  - lib/graphql/internal_representation.rb
379
379
  - lib/graphql/internal_representation/node.rb
380
380
  - lib/graphql/internal_representation/rewrite.rb
381
+ - lib/graphql/internal_representation/scope.rb
381
382
  - lib/graphql/internal_representation/visit.rb
382
383
  - lib/graphql/introspection.rb
383
384
  - lib/graphql/introspection/arguments_field.rb
@@ -416,6 +417,7 @@ files:
416
417
  - lib/graphql/object_type.rb
417
418
  - lib/graphql/query.rb
418
419
  - lib/graphql/query/arguments.rb
420
+ - lib/graphql/query/arguments_cache.rb
419
421
  - lib/graphql/query/context.rb
420
422
  - lib/graphql/query/executor.rb
421
423
  - lib/graphql/query/input_validation_result.rb
@@ -425,6 +427,7 @@ files:
425
427
  - lib/graphql/query/serial_execution/operation_resolution.rb
426
428
  - lib/graphql/query/serial_execution/selection_resolution.rb
427
429
  - lib/graphql/query/serial_execution/value_resolution.rb
430
+ - lib/graphql/query/validation_pipeline.rb
428
431
  - lib/graphql/query/variable_validation_error.rb
429
432
  - lib/graphql/query/variables.rb
430
433
  - lib/graphql/relay.rb
@@ -452,6 +455,7 @@ files:
452
455
  - lib/graphql/schema/instrumented_field_map.rb
453
456
  - lib/graphql/schema/invalid_type_error.rb
454
457
  - lib/graphql/schema/loader.rb
458
+ - lib/graphql/schema/mask.rb
455
459
  - lib/graphql/schema/middleware_chain.rb
456
460
  - lib/graphql/schema/null_mask.rb
457
461
  - lib/graphql/schema/possible_types.rb