lighthouse-graphql 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -1
  3. data/docs/getting-started.md +44 -11
  4. data/lib/lighthouse/ast_builder.rb +4 -1
  5. data/lib/lighthouse/cache_control.rb +14 -2
  6. data/lib/lighthouse/complexity.rb +11 -1
  7. data/lib/lighthouse/directive_resolvers/aggregate_resolver.rb +17 -1
  8. data/lib/lighthouse/directive_resolvers/all_resolver.rb +13 -1
  9. data/lib/lighthouse/directive_resolvers/association_resolvers.rb +65 -9
  10. data/lib/lighthouse/directive_resolvers/auth_resolver.rb +10 -1
  11. data/lib/lighthouse/directive_resolvers/base.rb +18 -0
  12. data/lib/lighthouse/directive_resolvers/broadcast_resolver.rb +12 -1
  13. data/lib/lighthouse/directive_resolvers/cache_resolvers.rb +28 -3
  14. data/lib/lighthouse/directive_resolvers/can_resolvers.rb +62 -9
  15. data/lib/lighthouse/directive_resolvers/count_resolver.rb +16 -1
  16. data/lib/lighthouse/directive_resolvers/event_resolver.rb +13 -1
  17. data/lib/lighthouse/directive_resolvers/field_resolver.rb +6 -1
  18. data/lib/lighthouse/directive_resolvers/find_resolver.rb +13 -1
  19. data/lib/lighthouse/directive_resolvers/first_resolver.rb +13 -1
  20. data/lib/lighthouse/directive_resolvers/guard_resolver.rb +10 -1
  21. data/lib/lighthouse/directive_resolvers/method_resolver.rb +13 -1
  22. data/lib/lighthouse/directive_resolvers/model_mutation_resolver.rb +74 -8
  23. data/lib/lighthouse/directive_resolvers/paginate_resolver.rb +17 -2
  24. data/lib/lighthouse/directive_resolvers/rename_resolver.rb +14 -1
  25. data/lib/lighthouse/directive_resolvers/subscription_resolver.rb +13 -1
  26. data/lib/lighthouse/directive_resolvers/validator_resolver.rb +13 -1
  27. data/lib/lighthouse/directives/arguments/base.rb +18 -0
  28. data/lib/lighthouse/directives/arguments/filters.rb +16 -7
  29. data/lib/lighthouse/directives/definitions.rb +43 -6
  30. data/lib/lighthouse/document_ast.rb +6 -0
  31. data/lib/lighthouse/enum_directive.rb +6 -1
  32. data/lib/lighthouse/feature_directive.rb +13 -1
  33. data/lib/lighthouse/graphql/version.rb +1 -1
  34. data/lib/lighthouse/graphql_ruby_patches.rb +26 -2
  35. data/lib/lighthouse/ide_helper.rb +7 -6
  36. data/lib/lighthouse/scalar_coercion.rb +4 -1
  37. data/lib/lighthouse/tasks/lighthouse.rake +8 -0
  38. data/lib/lighthouse/type_resolution.rb +8 -2
  39. data/sig/lighthouse/graphql.rbs +1 -0
  40. metadata +1 -1
@@ -7,6 +7,14 @@ namespace :lighthouse do
7
7
  Lighthouse::IdeHelper.write(output_dir: output_dir).each { |path| puts "Wrote #{path}" }
8
8
  end
9
9
 
10
+ desc 'Print the final schema (SDL) to stdout, as clients see it (SCHEMA=AppSchema)'
11
+ task print_schema: :environment do
12
+ schema = Object.const_get(ENV.fetch('SCHEMA', 'AppSchema'))
13
+ puts schema.to_definition
14
+ rescue StandardError => e
15
+ abort("#{schema || 'Schema'} can not be printed: #{e.message}")
16
+ end
17
+
10
18
  desc 'Build the schema cache in tmp/cache (for config.schema_cache; e.g. during a Docker build)'
11
19
  task cache: :environment do
12
20
  puts "Wrote #{Lighthouse::GraphQL::SchemaCache.warm!}"
@@ -26,14 +26,20 @@ module Lighthouse::GraphQL::TypeResolution
26
26
  The class that picks the object type of this union's values: `resolve_type(object, context)`
27
27
  or `call(object, context)`, returning a type name or a type class.
28
28
  """
29
- directive @union(resolveType: String!) on UNION
29
+ directive @union(
30
+ "The class to call, looked up in Config.namespaces[:types]. A fully-qualified name is used as-is."
31
+ resolveType: String!
32
+ ) on UNION
30
33
  GRAPHQL
31
34
  'interface' => <<~GRAPHQL.chomp
32
35
  """
33
36
  The class that picks the object type of this interface's values: `resolve_type(object, context)`
34
37
  or `call(object, context)`, returning a type name or a type class.
35
38
  """
36
- directive @interface(resolveType: String!) on INTERFACE
39
+ directive @interface(
40
+ "The class to call, looked up in Config.namespaces[:types]. A fully-qualified name is used as-is."
41
+ resolveType: String!
42
+ ) on INTERFACE
37
43
  GRAPHQL
38
44
  }.freeze
39
45
 
@@ -50,6 +50,7 @@ module Lighthouse
50
50
  def add: (untyped definition) -> untyped
51
51
  # Adds a type, or replaces the one of the same name.
52
52
  def put_type: (untyped definition) -> self
53
+ def remove_type: (String name) -> self
53
54
  # Adds the type parsed from the SDL (or the block's), unless one of the name exists.
54
55
  def define_type: (String name, ?String? sdl) ?{ () -> String } -> untyped
55
56
  def type?: (String name) -> bool
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lighthouse-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vaz Innovation