graphql 1.7.6 → 1.8.0
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/lib/generators/graphql/function_generator.rb +1 -1
- data/lib/generators/graphql/install_generator.rb +14 -8
- data/lib/generators/graphql/loader_generator.rb +1 -1
- data/lib/generators/graphql/mutation_generator.rb +6 -1
- data/lib/generators/graphql/templates/function.erb +2 -2
- data/lib/generators/graphql/templates/loader.erb +2 -2
- data/lib/generators/graphql/templates/schema.erb +1 -1
- data/lib/graphql/argument.rb +25 -19
- data/lib/graphql/backtrace/tracer.rb +16 -22
- data/lib/graphql/backtrace.rb +1 -1
- data/lib/graphql/backwards_compatibility.rb +2 -3
- data/lib/graphql/base_type.rb +31 -31
- data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +14 -0
- data/lib/graphql/compatibility/query_parser_specification.rb +117 -0
- data/lib/graphql/define/assign_object_field.rb +5 -12
- data/lib/graphql/deprecated_dsl.rb +42 -0
- data/lib/graphql/directive.rb +1 -0
- data/lib/graphql/enum_type.rb +3 -1
- data/lib/graphql/execution/execute.rb +21 -13
- data/lib/graphql/execution/instrumentation.rb +82 -0
- data/lib/graphql/execution/lazy/lazy_method_map.rb +1 -1
- data/lib/graphql/execution/lazy/resolve.rb +1 -3
- data/lib/graphql/execution/multiplex.rb +12 -29
- data/lib/graphql/execution.rb +1 -0
- data/lib/graphql/field.rb +21 -4
- data/lib/graphql/function.rb +14 -0
- data/lib/graphql/input_object_type.rb +3 -1
- data/lib/graphql/interface_type.rb +5 -3
- data/lib/graphql/internal_representation/node.rb +26 -14
- data/lib/graphql/internal_representation/visit.rb +3 -6
- data/lib/graphql/introspection/base_object.rb +16 -0
- data/lib/graphql/introspection/directive_location_enum.rb +11 -7
- data/lib/graphql/introspection/directive_type.rb +23 -16
- data/lib/graphql/introspection/dynamic_fields.rb +11 -0
- data/lib/graphql/introspection/entry_points.rb +29 -0
- data/lib/graphql/introspection/enum_value_type.rb +16 -11
- data/lib/graphql/introspection/field_type.rb +21 -12
- data/lib/graphql/introspection/input_value_type.rb +26 -23
- data/lib/graphql/introspection/schema_field.rb +7 -2
- data/lib/graphql/introspection/schema_type.rb +36 -22
- data/lib/graphql/introspection/type_by_name_field.rb +10 -2
- data/lib/graphql/introspection/type_kind_enum.rb +10 -6
- data/lib/graphql/introspection/type_type.rb +85 -23
- data/lib/graphql/introspection/typename_field.rb +1 -0
- data/lib/graphql/introspection.rb +3 -10
- data/lib/graphql/language/block_string.rb +47 -0
- data/lib/graphql/language/document_from_schema_definition.rb +280 -0
- data/lib/graphql/language/generation.rb +3 -182
- data/lib/graphql/language/lexer.rb +144 -69
- data/lib/graphql/language/lexer.rl +15 -4
- data/lib/graphql/language/nodes.rb +141 -78
- data/lib/graphql/language/parser.rb +677 -630
- data/lib/graphql/language/parser.y +18 -12
- data/lib/graphql/language/printer.rb +361 -0
- data/lib/graphql/language/token.rb +10 -3
- data/lib/graphql/language.rb +3 -0
- data/lib/graphql/non_null_type.rb +1 -1
- data/lib/graphql/object_type.rb +1 -6
- data/lib/graphql/query/arguments.rb +63 -32
- data/lib/graphql/query/context.rb +32 -2
- data/lib/graphql/query/literal_input.rb +4 -1
- data/lib/graphql/query/null_context.rb +1 -1
- data/lib/graphql/query/result.rb +1 -1
- data/lib/graphql/query/variables.rb +21 -3
- data/lib/graphql/query.rb +19 -6
- data/lib/graphql/railtie.rb +109 -0
- data/lib/graphql/relay/connection_resolve.rb +3 -0
- data/lib/graphql/relay/connection_type.rb +5 -3
- data/lib/graphql/relay/edge_type.rb +2 -1
- data/lib/graphql/relay/global_id_resolve.rb +5 -1
- data/lib/graphql/relay/mongo_relation_connection.rb +40 -0
- data/lib/graphql/relay/mutation/instrumentation.rb +1 -1
- data/lib/graphql/relay/mutation/resolve.rb +5 -1
- data/lib/graphql/relay/relation_connection.rb +14 -19
- data/lib/graphql/relay/type_extensions.rb +30 -0
- data/lib/graphql/relay.rb +2 -0
- data/lib/graphql/scalar_type.rb +14 -2
- data/lib/graphql/schema/argument.rb +92 -0
- data/lib/graphql/schema/build_from_definition.rb +64 -18
- data/lib/graphql/schema/enum.rb +85 -0
- data/lib/graphql/schema/enum_value.rb +74 -0
- data/lib/graphql/schema/field.rb +372 -0
- data/lib/graphql/schema/finder.rb +153 -0
- data/lib/graphql/schema/input_object.rb +87 -0
- data/lib/graphql/schema/interface.rb +105 -0
- data/lib/graphql/schema/introspection_system.rb +93 -0
- data/lib/graphql/schema/late_bound_type.rb +32 -0
- data/lib/graphql/schema/list.rb +32 -0
- data/lib/graphql/schema/loader.rb +2 -2
- data/lib/graphql/schema/member/accepts_definition.rb +152 -0
- data/lib/graphql/schema/member/base_dsl_methods.rb +100 -0
- data/lib/graphql/schema/member/build_type.rb +137 -0
- data/lib/graphql/schema/member/cached_graphql_definition.rb +26 -0
- data/lib/graphql/schema/member/graphql_type_names.rb +21 -0
- data/lib/graphql/schema/member/has_arguments.rb +50 -0
- data/lib/graphql/schema/member/has_fields.rb +130 -0
- data/lib/graphql/schema/member/instrumentation.rb +115 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +34 -0
- data/lib/graphql/schema/member.rb +28 -0
- data/lib/graphql/schema/middleware_chain.rb +5 -1
- data/lib/graphql/schema/mutation.rb +138 -0
- data/lib/graphql/schema/non_null.rb +38 -0
- data/lib/graphql/schema/object.rb +81 -0
- data/lib/graphql/schema/printer.rb +33 -266
- data/lib/graphql/schema/relay_classic_mutation.rb +87 -0
- data/lib/graphql/schema/rescue_middleware.rb +8 -7
- data/lib/graphql/schema/resolver.rb +122 -0
- data/lib/graphql/schema/scalar.rb +35 -0
- data/lib/graphql/schema/traversal.rb +102 -22
- data/lib/graphql/schema/union.rb +36 -0
- data/lib/graphql/schema/validation.rb +3 -2
- data/lib/graphql/schema.rb +381 -12
- data/lib/graphql/static_validation/definition_dependencies.rb +1 -1
- data/lib/graphql/static_validation/literal_validator.rb +16 -4
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +6 -6
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +5 -1
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +15 -8
- data/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +11 -1
- data/lib/graphql/static_validation/validation_context.rb +1 -1
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +7 -5
- data/lib/graphql/subscriptions/instrumentation.rb +5 -1
- data/lib/graphql/subscriptions/serialize.rb +2 -0
- data/lib/graphql/subscriptions.rb +90 -16
- data/lib/graphql/tracing/data_dog_tracing.rb +49 -0
- data/lib/graphql/tracing/new_relic_tracing.rb +26 -0
- data/lib/graphql/tracing/platform_tracing.rb +20 -7
- data/lib/graphql/tracing/scout_tracing.rb +2 -2
- data/lib/graphql/tracing.rb +1 -0
- data/lib/graphql/unresolved_type_error.rb +3 -2
- data/lib/graphql/upgrader/member.rb +894 -0
- data/lib/graphql/upgrader/schema.rb +37 -0
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +5 -25
- data/readme.md +2 -2
- data/spec/dummy/app/channels/graphql_channel.rb +23 -2
- data/spec/dummy/log/development.log +239 -0
- data/spec/dummy/log/test.log +410 -0
- data/spec/dummy/test/system/action_cable_subscription_test.rb +4 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-x/-xYZjAnuuzgR79fcznLTQtSdh6AARxu8FcQ_J6p7L3U.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/13/13HiV12xyoQvT-1L39ZzLwMZxjyaGMiENmfw7f-QTIc.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3W/3Wtf5pCWdqq0AB-iB0Y9uUNrTkruRxIEf1XFn_BETU0.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5i/5iguGafb4hOn8262Kn8Q37ogNN9MxxQKGKNzHAzUcvI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8m/8mj2T6yy847Mc2Z7k3Xzh8O91hhVJt3NrPe8ASNDlIA.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DT/DTQyMpr4ABZYQetsdRJ5A7S4jf1r3ie4FGOR7GZBNSs.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Dq/DqJ5_yJPrP5iLlOQyTQsjAVI5FE5LCVDkED0f7GgsSo.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/F8/F8MUNRzORGFgr329fNM0xLaoWCXdv3BIalT7dsvLfjs.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KB/KB07ZaKNC5uXJ7TjLi-WqnY6g7dq8wWp_8N3HNjBNxg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Rw/RwDuCV-XpnCtjNkvhpJfBuxXMk0b5AD3L9eR6M-wcy0.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/UL/ULdjhhb0bRuqmaG7XSZlFYzGYCXTDnqZuJBTWRlzqgw.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Up/UpPNgh0yYoUsyMDh5zWqe_U6qJIyTC6-dxMMAs1vvlM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wg/Wguh-szFGTI1gaL6npYwPekMXflugRei7F_mOyRucXg.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/X-/X-khLYMA9mqFRPg3zAi86mREDxpKl4bdKYp3uF6WHos.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bi/BIkdhfxsezxM4q-HZ4oCNTq97WEJTigcq0tpX2cDvbY.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ff/FfxmA4CMHQZT7exx0G7NS1Wpcnny0vzp-Jhc2H36bp8.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gE/gEiiG4GZNy_djEjK2pHm_NgA-gyhLZhdQvo0Yt96GqE.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gn/gnA9ZSqpjccNL2m8pe_jBvY6SinXlCzXDWyop83Od8s.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lO/lOAan3cMwCE_Hli6gsDML88xFNfn0nxPmvrSkW7eEOw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/m1/M1pv8MJEPLXGLvS8QxVh3DSO9cI4mRt5FHFWdrvUj6o.cache +2 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/m7/m77qH7ZqH0_0SmwJbiKGDd-aLau1Dav847DC6ge46zY.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/sj/sjRjnjRB37lH2vrgtkdJ8Cz84__IJ978IuKTM7HcztI.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/um/um1JrirR4hJhK-1rE-HywlyCi5ibgxHVrReiujZBWJM.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/v4/v4fwVytD7ITcE0_GDbslZEYud8a5Okm85fV1o7SDl6g.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/v_/v_0PAQt0iipQjFP5zjgkkk9Stnpf4VzvnMv67d1Keuw.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wd/wdT9U4MKxe1PyqNjVuCKMpCl3dxGCIRJIlwUTfh2DQU.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xI/xIaxut_fEIhKBDqljTNwYaADK9kj3gG0ESrfHs-5_og.cache +3 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/y0/y0SJOqIx2fn1SKqOkAihsQow0trRJrSIyAswufVuoA8.cache +0 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zg/zgpzeaX-KZErHyGJ1aBH3ZusweNXMneVZule88XsIJI.cache +1 -0
- data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zy/zYFltDy-8VC-uKq2BVEiJJyYXNFvVzAKuMlR3ZIYZsk.cache +0 -0
- data/spec/dummy/tmp/screenshots/failures_test_it_handles_subscriptions.png +0 -0
- data/spec/fixtures/upgrader/account.original.rb +19 -0
- data/spec/fixtures/upgrader/account.transformed.rb +20 -0
- data/spec/fixtures/upgrader/blame_range.original.rb +43 -0
- data/spec/fixtures/upgrader/blame_range.transformed.rb +30 -0
- data/spec/fixtures/upgrader/date_time.original.rb +24 -0
- data/spec/fixtures/upgrader/date_time.transformed.rb +23 -0
- data/spec/fixtures/upgrader/delete_project.original.rb +28 -0
- data/spec/fixtures/upgrader/delete_project.transformed.rb +27 -0
- data/spec/fixtures/upgrader/gist_order_field.original.rb +14 -0
- data/spec/fixtures/upgrader/gist_order_field.transformed.rb +13 -0
- data/spec/fixtures/upgrader/increment_count.original.rb +59 -0
- data/spec/fixtures/upgrader/increment_count.transformed.rb +50 -0
- data/spec/fixtures/upgrader/photo.original.rb +10 -0
- data/spec/fixtures/upgrader/photo.transformed.rb +12 -0
- data/spec/fixtures/upgrader/release_order.original.rb +15 -0
- data/spec/fixtures/upgrader/release_order.transformed.rb +14 -0
- data/spec/fixtures/upgrader/starrable.original.rb +49 -0
- data/spec/fixtures/upgrader/starrable.transformed.rb +46 -0
- data/spec/fixtures/upgrader/subscribable.original.rb +55 -0
- data/spec/fixtures/upgrader/subscribable.transformed.rb +51 -0
- data/spec/fixtures/upgrader/type_x.original.rb +65 -0
- data/spec/fixtures/upgrader/type_x.transformed.rb +56 -0
- data/spec/generators/graphql/function_generator_spec.rb +26 -0
- data/spec/generators/graphql/install_generator_spec.rb +1 -1
- data/spec/generators/graphql/loader_generator_spec.rb +24 -0
- data/spec/graphql/analysis/max_query_complexity_spec.rb +3 -3
- data/spec/graphql/analysis/max_query_depth_spec.rb +3 -3
- data/spec/graphql/argument_spec.rb +21 -0
- data/spec/graphql/backtrace_spec.rb +10 -0
- data/spec/graphql/base_type_spec.rb +42 -0
- data/spec/graphql/boolean_type_spec.rb +3 -3
- data/spec/graphql/directive_spec.rb +3 -1
- data/spec/graphql/enum_type_spec.rb +18 -5
- data/spec/graphql/execution/execute_spec.rb +4 -4
- data/spec/graphql/execution/instrumentation_spec.rb +165 -0
- data/spec/graphql/execution/multiplex_spec.rb +2 -2
- data/spec/graphql/execution_error_spec.rb +18 -0
- data/spec/graphql/float_type_spec.rb +2 -2
- data/spec/graphql/id_type_spec.rb +1 -1
- data/spec/graphql/input_object_type_spec.rb +15 -2
- data/spec/graphql/int_type_spec.rb +2 -2
- data/spec/graphql/interface_type_spec.rb +12 -0
- data/spec/graphql/internal_representation/rewrite_spec.rb +2 -2
- data/spec/graphql/introspection/schema_type_spec.rb +2 -0
- data/spec/graphql/language/block_string_spec.rb +70 -0
- data/spec/graphql/language/document_from_schema_definition_spec.rb +770 -0
- data/spec/graphql/language/generation_spec.rb +21 -186
- data/spec/graphql/language/lexer_spec.rb +21 -1
- data/spec/graphql/language/nodes_spec.rb +21 -12
- data/spec/graphql/language/parser_spec.rb +1 -1
- data/spec/graphql/language/printer_spec.rb +203 -0
- data/spec/graphql/object_type_spec.rb +22 -0
- data/spec/graphql/query/arguments_spec.rb +25 -15
- data/spec/graphql/query/context_spec.rb +18 -0
- data/spec/graphql/query/executor_spec.rb +2 -1
- data/spec/graphql/query/serial_execution/value_resolution_spec.rb +2 -8
- data/spec/graphql/query/variables_spec.rb +42 -1
- data/spec/graphql/query_spec.rb +31 -5
- data/spec/graphql/rake_task_spec.rb +3 -1
- data/spec/graphql/relay/base_connection_spec.rb +1 -1
- data/spec/graphql/relay/connection_instrumentation_spec.rb +2 -2
- data/spec/graphql/relay/connection_resolve_spec.rb +1 -1
- data/spec/graphql/relay/connection_type_spec.rb +1 -1
- data/spec/graphql/relay/mongo_relation_connection_spec.rb +474 -0
- data/spec/graphql/relay/mutation_spec.rb +9 -7
- data/spec/graphql/relay/range_add_spec.rb +5 -1
- data/spec/graphql/relay/relation_connection_spec.rb +65 -1
- data/spec/graphql/schema/argument_spec.rb +87 -0
- data/spec/graphql/schema/build_from_definition_spec.rb +89 -5
- data/spec/graphql/schema/enum_spec.rb +74 -0
- data/spec/graphql/schema/field_spec.rb +225 -0
- data/spec/graphql/schema/finder_spec.rb +135 -0
- data/spec/graphql/schema/input_object_spec.rb +111 -0
- data/spec/graphql/schema/instrumentation_spec.rb +40 -0
- data/spec/graphql/schema/interface_spec.rb +185 -0
- data/spec/graphql/schema/introspection_system_spec.rb +39 -0
- data/spec/graphql/schema/member/accepts_definition_spec.rb +111 -0
- data/spec/graphql/schema/member/build_type_spec.rb +17 -0
- data/spec/graphql/schema/member/has_fields_spec.rb +129 -0
- data/spec/graphql/schema/member/type_system_helpers_spec.rb +63 -0
- data/spec/graphql/schema/mutation_spec.rb +148 -0
- data/spec/graphql/schema/object_spec.rb +175 -0
- data/spec/graphql/schema/printer_spec.rb +111 -15
- data/spec/graphql/schema/relay_classic_mutation_spec.rb +38 -0
- data/spec/graphql/schema/rescue_middleware_spec.rb +11 -0
- data/spec/graphql/schema/resolver_spec.rb +131 -0
- data/spec/graphql/schema/scalar_spec.rb +95 -0
- data/spec/graphql/schema/traversal_spec.rb +31 -0
- data/spec/graphql/schema/union_spec.rb +65 -0
- data/spec/graphql/schema/validation_spec.rb +1 -1
- data/spec/graphql/schema/warden_spec.rb +11 -11
- data/spec/graphql/schema_spec.rb +55 -12
- data/spec/graphql/static_validation/rules/fields_have_appropriate_selections_spec.rb +10 -2
- data/spec/graphql/static_validation/rules/fields_will_merge_spec.rb +2 -2
- data/spec/graphql/string_type_spec.rb +3 -3
- data/spec/graphql/subscriptions_spec.rb +273 -184
- data/spec/graphql/tracing/active_support_notifications_tracing_spec.rb +1 -1
- data/spec/graphql/tracing/new_relic_tracing_spec.rb +47 -0
- data/spec/graphql/tracing/platform_tracing_spec.rb +60 -1
- data/spec/graphql/union_type_spec.rb +1 -1
- data/spec/graphql/upgrader/member_spec.rb +516 -0
- data/spec/graphql/upgrader/schema_spec.rb +82 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/support/dummy/schema.rb +53 -24
- data/spec/support/jazz.rb +544 -0
- data/spec/support/lazy_helpers.rb +21 -23
- data/spec/support/new_relic.rb +24 -0
- data/spec/support/star_trek/data.rb +109 -0
- data/spec/support/star_trek/schema.rb +388 -0
- data/spec/support/star_wars/data.rb +6 -7
- data/spec/support/star_wars/schema.rb +127 -171
- metadata +233 -11
- data/lib/graphql/introspection/arguments_field.rb +0 -7
- data/lib/graphql/introspection/enum_values_field.rb +0 -18
- data/lib/graphql/introspection/fields_field.rb +0 -13
- data/lib/graphql/introspection/input_fields_field.rb +0 -12
- data/lib/graphql/introspection/interfaces_field.rb +0 -11
- data/lib/graphql/introspection/of_type_field.rb +0 -6
- data/lib/graphql/introspection/possible_types_field.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5283bf51e22ac60f8d9368d9cc19b8c6d038d8b
|
4
|
+
data.tar.gz: 147ec429661a6fbc1aaef685ba94c8a81d87910e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06a2a8730fc1c13dc0a0d76a35b19e89dd40ad842e41618abb1b05a7f75b667eede56c106728e3e68bd531e36e29b28050b991319599b7952ac3285fb3f9be3c
|
7
|
+
data.tar.gz: 8231c7696681477decf92b0665f3e4249b308153338c8d7cf5102b7e95133b9ac7aa6156f3dddc026c4178ea9fcb25d7f181f752298d5cf38185141af653a471
|
@@ -11,7 +11,7 @@ module Graphql
|
|
11
11
|
source_root File.expand_path('../templates', __FILE__)
|
12
12
|
|
13
13
|
def create_function_file
|
14
|
-
template "function.erb", "#{options[:directory]}/functions/#{
|
14
|
+
template "function.erb", "#{options[:directory]}/functions/#{file_path}.rb"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -81,13 +81,6 @@ module Graphql
|
|
81
81
|
type: :boolean,
|
82
82
|
desc: "Preconfigure smaller stack for API only apps"
|
83
83
|
|
84
|
-
|
85
|
-
GRAPHIQL_ROUTE = <<-RUBY
|
86
|
-
if Rails.env.development?
|
87
|
-
mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/graphql"
|
88
|
-
end
|
89
|
-
RUBY
|
90
|
-
|
91
84
|
def create_folder_structure
|
92
85
|
create_dir("#{options[:directory]}/types")
|
93
86
|
template("schema.erb", schema_file_path)
|
@@ -115,7 +108,20 @@ RUBY
|
|
115
108
|
# This is a little cheat just to get cleaner shell output:
|
116
109
|
log :route, 'graphiql-rails'
|
117
110
|
shell.mute do
|
118
|
-
route
|
111
|
+
# Rails 5.2 has better support for `route`?
|
112
|
+
if Rails::VERSION::STRING > "5.2"
|
113
|
+
route <<-RUBY
|
114
|
+
if Rails.env.development?
|
115
|
+
mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/graphql"
|
116
|
+
end
|
117
|
+
RUBY
|
118
|
+
else
|
119
|
+
route <<-RUBY
|
120
|
+
if Rails.env.development?
|
121
|
+
mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/graphql"
|
122
|
+
end
|
123
|
+
RUBY
|
124
|
+
end
|
119
125
|
end
|
120
126
|
end
|
121
127
|
|
@@ -13,7 +13,7 @@ module Graphql
|
|
13
13
|
source_root File.expand_path('../templates', __FILE__)
|
14
14
|
|
15
15
|
def create_loader_file
|
16
|
-
template "loader.erb", "#{options[:directory]}/loaders/#{
|
16
|
+
template "loader.erb", "#{options[:directory]}/loaders/#{file_path}.rb"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -27,7 +27,12 @@ module Graphql
|
|
27
27
|
attr_reader :file_name, :mutation_name, :field_name
|
28
28
|
|
29
29
|
def create_mutation_file
|
30
|
-
|
30
|
+
unless @behavior == :revoke
|
31
|
+
create_mutation_root_type
|
32
|
+
else
|
33
|
+
log :gsub, "#{options[:directory]}/types/mutation_type.rb"
|
34
|
+
end
|
35
|
+
|
31
36
|
template "mutation.erb", "#{options[:directory]}/mutations/#{file_name}.rb"
|
32
37
|
|
33
38
|
sentinel = /name "Mutation"\s*\n/m
|
@@ -1,7 +1,7 @@
|
|
1
|
-
class Functions::<%=
|
1
|
+
class Functions::<%= class_name %> < GraphQL::Function
|
2
2
|
# Define `initialize` to store field-level options, eg
|
3
3
|
#
|
4
|
-
# field :myField, function: Functions::<%=
|
4
|
+
# field :myField, function: Functions::<%= class_name %>.new(type: MyType)
|
5
5
|
#
|
6
6
|
# attr_reader :type
|
7
7
|
# def initialize(type:)
|
@@ -1,7 +1,7 @@
|
|
1
|
-
class Loaders::<%=
|
1
|
+
class Loaders::<%= class_name %> < GraphQL::Batch::Loader
|
2
2
|
# Define `initialize` to store grouping arguments, eg
|
3
3
|
#
|
4
|
-
# Loaders::<%=
|
4
|
+
# Loaders::<%= class_name %>.for(group).load(value)
|
5
5
|
#
|
6
6
|
# def initialize()
|
7
7
|
# end
|
data/lib/graphql/argument.rb
CHANGED
@@ -37,6 +37,7 @@ module GraphQL
|
|
37
37
|
include GraphQL::Define::InstanceDefinable
|
38
38
|
accepts_definitions :name, :type, :description, :default_value, :as, :prepare
|
39
39
|
attr_accessor :type, :description, :default_value, :name, :as
|
40
|
+
attr_accessor :ast_node
|
40
41
|
|
41
42
|
ensure_defined(:name, :description, :default_value, :type=, :type, :as, :expose_as, :prepare)
|
42
43
|
|
@@ -58,8 +59,13 @@ module GraphQL
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def default_value=(new_default_value)
|
61
|
-
|
62
|
-
|
62
|
+
if new_default_value == NO_DEFAULT_VALUE
|
63
|
+
@has_default_value = false
|
64
|
+
@default_value = nil
|
65
|
+
else
|
66
|
+
@has_default_value = true
|
67
|
+
@default_value = new_default_value
|
68
|
+
end
|
63
69
|
end
|
64
70
|
|
65
71
|
# @!attribute name
|
@@ -97,28 +103,28 @@ module GraphQL
|
|
97
103
|
NO_DEFAULT_VALUE = Object.new
|
98
104
|
# @api private
|
99
105
|
def self.from_dsl(name, type_or_argument = nil, description = nil, default_value: NO_DEFAULT_VALUE, as: nil, prepare: DefaultPrepare, **kwargs, &block)
|
100
|
-
|
101
|
-
return type_or_argument.redefine(name: name.to_s)
|
102
|
-
end
|
106
|
+
name_s = name.to_s
|
103
107
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
108
|
+
# Move some positional args into keywords if they're present
|
109
|
+
description && kwargs[:description] ||= description
|
110
|
+
kwargs[:name] ||= name_s
|
111
|
+
kwargs[:default_value] ||= default_value
|
112
|
+
kwargs[:as] ||= as
|
109
113
|
|
110
|
-
|
111
|
-
|
112
|
-
description && argument.description = description
|
113
|
-
if default_value != NO_DEFAULT_VALUE
|
114
|
-
argument.default_value = default_value
|
114
|
+
unless prepare == DefaultPrepare
|
115
|
+
kwargs[:prepare] ||= prepare
|
115
116
|
end
|
116
|
-
|
117
|
-
if
|
118
|
-
|
117
|
+
|
118
|
+
if !type_or_argument.nil? && !type_or_argument.is_a?(GraphQL::Argument)
|
119
|
+
# Maybe a string, proc or BaseType
|
120
|
+
kwargs[:type] = type_or_argument
|
119
121
|
end
|
120
122
|
|
121
|
-
|
123
|
+
if type_or_argument.is_a?(GraphQL::Argument)
|
124
|
+
type_or_argument.redefine(kwargs, &block)
|
125
|
+
else
|
126
|
+
GraphQL::Argument.define(kwargs, &block)
|
127
|
+
end
|
122
128
|
end
|
123
129
|
end
|
124
130
|
end
|
@@ -22,30 +22,24 @@ module GraphQL
|
|
22
22
|
end
|
23
23
|
|
24
24
|
if push_data
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
Thread.current[:last_graphql_backtrace_context] = push_data
|
26
|
+
end
|
27
|
+
|
28
|
+
if key == "execute_multiplex"
|
29
|
+
begin
|
30
|
+
yield
|
31
|
+
rescue StandardError => err
|
32
|
+
# This is an unhandled error from execution,
|
33
|
+
# Re-raise it with a GraphQL trace.
|
34
|
+
potential_context = Thread.current[:last_graphql_backtrace_context]
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
ensure
|
42
|
-
execution_context.clear
|
36
|
+
if potential_context.is_a?(GraphQL::Query::Context) || potential_context.is_a?(GraphQL::Query::Context::FieldResolutionContext)
|
37
|
+
raise TracedError.new(err, potential_context)
|
38
|
+
else
|
39
|
+
raise
|
43
40
|
end
|
44
|
-
|
45
|
-
|
46
|
-
res = yield
|
47
|
-
execution_context.pop
|
48
|
-
res
|
41
|
+
ensure
|
42
|
+
Thread.current[:last_graphql_backtrace_context] = nil
|
49
43
|
end
|
50
44
|
else
|
51
45
|
yield
|
data/lib/graphql/backtrace.rb
CHANGED
@@ -12,11 +12,10 @@ module GraphQL
|
|
12
12
|
# If `last`, then use the last arguments to call the function.
|
13
13
|
def wrap_arity(callable, from:, to:, name:, last: false)
|
14
14
|
arity = get_arity(callable)
|
15
|
-
|
16
|
-
when to
|
15
|
+
if arity == to || arity < 0
|
17
16
|
# It already matches, return it as is
|
18
17
|
callable
|
19
|
-
|
18
|
+
elsif arity == from
|
20
19
|
# It has the old arity, so wrap it with an arity converter
|
21
20
|
message ="#{name} with #{from} arguments is deprecated, it now accepts #{to} arguments, see:"
|
22
21
|
backtrace = caller(0, 20)
|
data/lib/graphql/base_type.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require "graphql/relay/type_extensions"
|
3
|
+
|
2
4
|
module GraphQL
|
3
5
|
# The parent for all type classes.
|
4
6
|
class BaseType
|
5
7
|
include GraphQL::Define::NonNullWithBang
|
6
8
|
include GraphQL::Define::InstanceDefinable
|
9
|
+
include GraphQL::Relay::TypeExtensions
|
10
|
+
|
7
11
|
accepts_definitions :name, :description,
|
8
12
|
:introspection,
|
9
13
|
:default_scalar,
|
@@ -13,7 +17,9 @@ module GraphQL
|
|
13
17
|
global_id_field: GraphQL::Define::AssignGlobalIdField,
|
14
18
|
}
|
15
19
|
|
16
|
-
ensure_defined(:name, :description, :introspection?, :default_scalar?)
|
20
|
+
ensure_defined(:graphql_name, :name, :description, :introspection?, :default_scalar?)
|
21
|
+
|
22
|
+
attr_accessor :ast_node
|
17
23
|
|
18
24
|
def initialize
|
19
25
|
@introspection = false
|
@@ -30,6 +36,17 @@ module GraphQL
|
|
30
36
|
|
31
37
|
# @return [String] the name of this type, must be unique within a Schema
|
32
38
|
attr_accessor :name
|
39
|
+
# Future-compatible alias
|
40
|
+
# @see {GraphQL::SchemaMember}
|
41
|
+
alias :graphql_name :name
|
42
|
+
# Future-compatible alias
|
43
|
+
# @see {GraphQL::SchemaMember}
|
44
|
+
alias :graphql_definition :itself
|
45
|
+
|
46
|
+
def name=(name)
|
47
|
+
GraphQL::NameValidator.validate!(name)
|
48
|
+
@name = name
|
49
|
+
end
|
33
50
|
|
34
51
|
# @return [String, nil] a description for this type
|
35
52
|
attr_accessor :description
|
@@ -54,12 +71,9 @@ module GraphQL
|
|
54
71
|
|
55
72
|
# @param other [GraphQL::BaseType] compare to this object
|
56
73
|
# @return [Boolean] are these types equivalent? (incl. non-null, list)
|
74
|
+
# @see {ModifiesAnotherType#==} for override on List & NonNull types
|
57
75
|
def ==(other)
|
58
|
-
|
59
|
-
self.to_s == other.to_s
|
60
|
-
else
|
61
|
-
super
|
62
|
-
end
|
76
|
+
other.is_a?(GraphQL::BaseType) && self.name == other.name
|
63
77
|
end
|
64
78
|
|
65
79
|
# If this type is modifying an underlying type,
|
@@ -82,6 +96,10 @@ module GraphQL
|
|
82
96
|
def unwrap
|
83
97
|
self.of_type.unwrap
|
84
98
|
end
|
99
|
+
|
100
|
+
def ==(other)
|
101
|
+
other.is_a?(ModifiesAnotherType) && other.of_type == of_type
|
102
|
+
end
|
85
103
|
end
|
86
104
|
|
87
105
|
# Find out which possible type to use for `value`.
|
@@ -164,38 +182,20 @@ module GraphQL
|
|
164
182
|
def self.resolve_related_type(type_arg)
|
165
183
|
case type_arg
|
166
184
|
when Proc
|
167
|
-
# lazy-eval it
|
168
|
-
type_arg.call
|
185
|
+
# lazy-eval it, then try again
|
186
|
+
resolve_related_type(type_arg.call)
|
169
187
|
when String
|
170
188
|
# Get a constant by this name
|
171
189
|
Object.const_get(type_arg)
|
172
190
|
else
|
173
|
-
type_arg
|
191
|
+
if type_arg.respond_to?(:graphql_definition)
|
192
|
+
type_arg.graphql_definition
|
193
|
+
else
|
194
|
+
type_arg
|
195
|
+
end
|
174
196
|
end
|
175
197
|
end
|
176
198
|
|
177
|
-
# @return [GraphQL::ObjectType] The default connection type for this object type
|
178
|
-
def connection_type
|
179
|
-
@connection_type ||= define_connection
|
180
|
-
end
|
181
|
-
|
182
|
-
# Define a custom connection type for this object type
|
183
|
-
# @return [GraphQL::ObjectType]
|
184
|
-
def define_connection(**kwargs, &block)
|
185
|
-
GraphQL::Relay::ConnectionType.create_type(self, **kwargs, &block)
|
186
|
-
end
|
187
|
-
|
188
|
-
# @return [GraphQL::ObjectType] The default edge type for this object type
|
189
|
-
def edge_type
|
190
|
-
@edge_type ||= define_edge
|
191
|
-
end
|
192
|
-
|
193
|
-
# Define a custom edge type for this object type
|
194
|
-
# @return [GraphQL::ObjectType]
|
195
|
-
def define_edge(**kwargs, &block)
|
196
|
-
GraphQL::Relay::EdgeType.create_type(self, **kwargs, &block)
|
197
|
-
end
|
198
|
-
|
199
199
|
# Return a GraphQL string for the type definition
|
200
200
|
# @param schema [GraphQL::Schema]
|
201
201
|
# @param printer [GraphQL::Schema::Printer]
|
@@ -56,6 +56,20 @@ module GraphQL
|
|
56
56
|
assert_raises_parse_error(%|{ field(arg:"\\uXXXF") }|)
|
57
57
|
end
|
58
58
|
|
59
|
+
def test_it_rejects_empty_inline_fragments
|
60
|
+
assert_raises_parse_error("
|
61
|
+
query {
|
62
|
+
viewer {
|
63
|
+
login {
|
64
|
+
... on String {
|
65
|
+
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
")
|
71
|
+
end
|
72
|
+
|
59
73
|
def assert_empty_document(query_string)
|
60
74
|
doc = parse(query_string)
|
61
75
|
assert_equal 0, doc.definitions.length
|
@@ -67,6 +67,10 @@ module GraphQL
|
|
67
67
|
nullValue: null
|
68
68
|
nullValueInObject: {a: null, b: "b"}
|
69
69
|
nullValueInArray: ["a", null, "b"]
|
70
|
+
blockString: """
|
71
|
+
Hello,
|
72
|
+
World
|
73
|
+
"""
|
70
74
|
)
|
71
75
|
}
|
72
76
|
|
|
@@ -100,6 +104,9 @@ module GraphQL
|
|
100
104
|
assert_equal 'a', values[0]
|
101
105
|
assert_instance_of GraphQL::Language::Nodes::NullValue, values[1]
|
102
106
|
assert_equal 'b', values[2]
|
107
|
+
|
108
|
+
block_str_value = inputs[12].value
|
109
|
+
assert_equal "Hello,\n World", block_str_value
|
103
110
|
end
|
104
111
|
|
105
112
|
def test_it_doesnt_parse_nonsense_variables
|
@@ -116,6 +123,116 @@ module GraphQL
|
|
116
123
|
end
|
117
124
|
assert_equal [1,26], [err_2.line, err_2.col]
|
118
125
|
end
|
126
|
+
|
127
|
+
def test_enum_value_definitions_have_a_position
|
128
|
+
document = parse("""
|
129
|
+
enum Enum {
|
130
|
+
VALUE
|
131
|
+
}
|
132
|
+
""")
|
133
|
+
|
134
|
+
assert_equal [3, 17], document.definitions[0].values[0].position
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_field_definitions_have_a_position
|
138
|
+
document = parse("""
|
139
|
+
type A {
|
140
|
+
field: String
|
141
|
+
}
|
142
|
+
""")
|
143
|
+
|
144
|
+
assert_equal [3, 17], document.definitions[0].fields[0].position
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_input_value_definitions_have_a_position
|
148
|
+
document = parse("""
|
149
|
+
input A {
|
150
|
+
field: String
|
151
|
+
}
|
152
|
+
""")
|
153
|
+
|
154
|
+
assert_equal [3, 17], document.definitions[0].fields[0].position
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_parses_when_there_are_no_interfaces
|
158
|
+
schema = "
|
159
|
+
type A {
|
160
|
+
a: String
|
161
|
+
}
|
162
|
+
"
|
163
|
+
|
164
|
+
document = parse(schema)
|
165
|
+
|
166
|
+
assert_equal [], document.definitions[0].interfaces.map(&:name)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_parses_implements_with_leading_ampersand
|
170
|
+
schema = "
|
171
|
+
type A implements & B {
|
172
|
+
a: String
|
173
|
+
}
|
174
|
+
"
|
175
|
+
|
176
|
+
document = parse(schema)
|
177
|
+
|
178
|
+
assert_equal ["B"], document.definitions[0].interfaces.map(&:name)
|
179
|
+
assert_equal [2, 35], document.definitions[0].interfaces[0].position
|
180
|
+
end
|
181
|
+
|
182
|
+
def test_parses_implements_with_leading_ampersand_and_multiple_interfaces
|
183
|
+
schema = "
|
184
|
+
type A implements & B & C {
|
185
|
+
a: String
|
186
|
+
}
|
187
|
+
"
|
188
|
+
|
189
|
+
document = parse(schema)
|
190
|
+
|
191
|
+
assert_equal ["B", "C"], document.definitions[0].interfaces.map(&:name)
|
192
|
+
assert_equal [2, 35], document.definitions[0].interfaces[0].position
|
193
|
+
assert_equal [2, 39], document.definitions[0].interfaces[1].position
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_parses_implements_without_leading_ampersand
|
197
|
+
schema = "
|
198
|
+
type A implements B {
|
199
|
+
a: String
|
200
|
+
}
|
201
|
+
"
|
202
|
+
|
203
|
+
document = parse(schema)
|
204
|
+
|
205
|
+
assert_equal ["B"], document.definitions[0].interfaces.map(&:name)
|
206
|
+
assert_equal [2, 33], document.definitions[0].interfaces[0].position
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_parses_implements_without_leading_ampersand_and_multiple_interfaces
|
210
|
+
schema = "
|
211
|
+
type A implements B & C {
|
212
|
+
a: String
|
213
|
+
}
|
214
|
+
"
|
215
|
+
|
216
|
+
document = parse(schema)
|
217
|
+
|
218
|
+
assert_equal ["B", "C"], document.definitions[0].interfaces.map(&:name)
|
219
|
+
assert_equal [2, 33], document.definitions[0].interfaces[0].position
|
220
|
+
assert_equal [2, 37], document.definitions[0].interfaces[1].position
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_supports_old_syntax_for_parsing_multiple_interfaces
|
224
|
+
schema = "
|
225
|
+
type A implements B, C {
|
226
|
+
a: String
|
227
|
+
}
|
228
|
+
"
|
229
|
+
|
230
|
+
document = parse(schema)
|
231
|
+
|
232
|
+
assert_equal ["B", "C"], document.definitions[0].interfaces.map(&:name)
|
233
|
+
assert_equal [2, 33], document.definitions[0].interfaces[0].position
|
234
|
+
assert_equal [2, 36], document.definitions[0].interfaces[1].position
|
235
|
+
end
|
119
236
|
end
|
120
237
|
end
|
121
238
|
|
@@ -18,23 +18,16 @@ module GraphQL
|
|
18
18
|
base_field = if type_or_field.is_a?(GraphQL::Field)
|
19
19
|
type_or_field.redefine(name: name_s)
|
20
20
|
elsif function
|
21
|
-
GraphQL::
|
22
|
-
|
23
|
-
|
24
|
-
name: name_s,
|
25
|
-
type: function.type,
|
26
|
-
resolve: function,
|
27
|
-
description: function.description,
|
28
|
-
function: function,
|
29
|
-
deprecation_reason: function.deprecation_reason,
|
30
|
-
)
|
21
|
+
func_field = GraphQL::Function.build_field(function)
|
22
|
+
func_field.name = name_s
|
23
|
+
func_field
|
31
24
|
elsif field.is_a?(GraphQL::Field)
|
32
25
|
field.redefine(name: name_s)
|
33
26
|
else
|
34
27
|
nil
|
35
28
|
end
|
36
29
|
|
37
|
-
|
30
|
+
obj_field = if base_field
|
38
31
|
base_field.redefine(kwargs, &block)
|
39
32
|
else
|
40
33
|
GraphQL::Field.define(kwargs, &block)
|
@@ -42,7 +35,7 @@ module GraphQL
|
|
42
35
|
|
43
36
|
|
44
37
|
# Attach the field to the type
|
45
|
-
owner_type.fields[name_s] =
|
38
|
+
owner_type.fields[name_s] = obj_field
|
46
39
|
end
|
47
40
|
end
|
48
41
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module GraphQL
|
3
|
+
# There are two ways to apply the deprecated `!` DSL to class-style schema definitions:
|
4
|
+
#
|
5
|
+
# 1. Scoped by file (CRuby only), add to the top of the file:
|
6
|
+
#
|
7
|
+
# using GraphQL::DeprecatedDSL
|
8
|
+
#
|
9
|
+
# (This is a "refinement", there are also other ways to scope it.)
|
10
|
+
#
|
11
|
+
# 2. Global application, add before schema definition:
|
12
|
+
#
|
13
|
+
# GraphQL::DeprecatedDSL.activate
|
14
|
+
#
|
15
|
+
module DeprecatedDSL
|
16
|
+
TYPE_CLASSES = [
|
17
|
+
GraphQL::Schema::Scalar,
|
18
|
+
GraphQL::Schema::Enum,
|
19
|
+
GraphQL::Schema::InputObject,
|
20
|
+
GraphQL::Schema::Union,
|
21
|
+
GraphQL::Schema::Interface,
|
22
|
+
GraphQL::Schema::Object,
|
23
|
+
]
|
24
|
+
|
25
|
+
def self.activate
|
26
|
+
TYPE_CLASSES.each { |c| c.extend(Methods) }
|
27
|
+
GraphQL::Schema::List.include(Methods)
|
28
|
+
GraphQL::Schema::NonNull.include(Methods)
|
29
|
+
end
|
30
|
+
module Methods
|
31
|
+
def !
|
32
|
+
to_non_null_type
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
TYPE_CLASSES.each do |type_class|
|
37
|
+
refine type_class.singleton_class do
|
38
|
+
include Methods
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/graphql/directive.rb
CHANGED
@@ -11,6 +11,7 @@ module GraphQL
|
|
11
11
|
accepts_definitions :locations, :name, :description, :arguments, :default_directive, argument: GraphQL::Define::AssignArgument
|
12
12
|
|
13
13
|
attr_accessor :locations, :arguments, :name, :description, :arguments_class
|
14
|
+
attr_accessor :ast_node
|
14
15
|
# @api private
|
15
16
|
attr_writer :default_directive
|
16
17
|
ensure_defined(:locations, :arguments, :name, :description, :default_directive?)
|
data/lib/graphql/enum_type.rb
CHANGED
@@ -74,6 +74,7 @@ module GraphQL
|
|
74
74
|
class EnumType < GraphQL::BaseType
|
75
75
|
accepts_definitions :values, value: GraphQL::Define::AssignEnumValue
|
76
76
|
ensure_defined(:values, :validate_non_null_input, :coerce_non_null_input, :coerce_result)
|
77
|
+
attr_accessor :ast_node
|
77
78
|
|
78
79
|
def initialize
|
79
80
|
super
|
@@ -121,7 +122,7 @@ module GraphQL
|
|
121
122
|
if enum_value
|
122
123
|
enum_value.name
|
123
124
|
else
|
124
|
-
raise(UnresolvedValueError, "Can't resolve enum #{name} for #{value}")
|
125
|
+
raise(UnresolvedValueError, "Can't resolve enum #{name} for #{value.inspect}")
|
125
126
|
end
|
126
127
|
end
|
127
128
|
|
@@ -137,6 +138,7 @@ module GraphQL
|
|
137
138
|
ATTRIBUTES = [:name, :description, :deprecation_reason, :value]
|
138
139
|
accepts_definitions(*ATTRIBUTES)
|
139
140
|
attr_accessor(*ATTRIBUTES)
|
141
|
+
attr_accessor :ast_node
|
140
142
|
ensure_defined(*ATTRIBUTES)
|
141
143
|
|
142
144
|
def name=(new_name)
|