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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -1
- data/docs/getting-started.md +44 -11
- data/lib/lighthouse/ast_builder.rb +4 -1
- data/lib/lighthouse/cache_control.rb +14 -2
- data/lib/lighthouse/complexity.rb +11 -1
- data/lib/lighthouse/directive_resolvers/aggregate_resolver.rb +17 -1
- data/lib/lighthouse/directive_resolvers/all_resolver.rb +13 -1
- data/lib/lighthouse/directive_resolvers/association_resolvers.rb +65 -9
- data/lib/lighthouse/directive_resolvers/auth_resolver.rb +10 -1
- data/lib/lighthouse/directive_resolvers/base.rb +18 -0
- data/lib/lighthouse/directive_resolvers/broadcast_resolver.rb +12 -1
- data/lib/lighthouse/directive_resolvers/cache_resolvers.rb +28 -3
- data/lib/lighthouse/directive_resolvers/can_resolvers.rb +62 -9
- data/lib/lighthouse/directive_resolvers/count_resolver.rb +16 -1
- data/lib/lighthouse/directive_resolvers/event_resolver.rb +13 -1
- data/lib/lighthouse/directive_resolvers/field_resolver.rb +6 -1
- data/lib/lighthouse/directive_resolvers/find_resolver.rb +13 -1
- data/lib/lighthouse/directive_resolvers/first_resolver.rb +13 -1
- data/lib/lighthouse/directive_resolvers/guard_resolver.rb +10 -1
- data/lib/lighthouse/directive_resolvers/method_resolver.rb +13 -1
- data/lib/lighthouse/directive_resolvers/model_mutation_resolver.rb +74 -8
- data/lib/lighthouse/directive_resolvers/paginate_resolver.rb +17 -2
- data/lib/lighthouse/directive_resolvers/rename_resolver.rb +14 -1
- data/lib/lighthouse/directive_resolvers/subscription_resolver.rb +13 -1
- data/lib/lighthouse/directive_resolvers/validator_resolver.rb +13 -1
- data/lib/lighthouse/directives/arguments/base.rb +18 -0
- data/lib/lighthouse/directives/arguments/filters.rb +16 -7
- data/lib/lighthouse/directives/definitions.rb +43 -6
- data/lib/lighthouse/document_ast.rb +6 -0
- data/lib/lighthouse/enum_directive.rb +6 -1
- data/lib/lighthouse/feature_directive.rb +13 -1
- data/lib/lighthouse/graphql/version.rb +1 -1
- data/lib/lighthouse/graphql_ruby_patches.rb +26 -2
- data/lib/lighthouse/ide_helper.rb +7 -6
- data/lib/lighthouse/scalar_coercion.rb +4 -1
- data/lib/lighthouse/tasks/lighthouse.rake +8 -0
- data/lib/lighthouse/type_resolution.rb +8 -2
- data/sig/lighthouse/graphql.rbs +1 -0
- 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(
|
|
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(
|
|
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
|
|
data/sig/lighthouse/graphql.rbs
CHANGED
|
@@ -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
|