graphql 2.6.14 → 2.6.16
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/core.rb +1 -0
- data/lib/generators/graphql/detailed_trace_generator.rb +1 -0
- data/lib/generators/graphql/enum_generator.rb +1 -0
- data/lib/generators/graphql/field_extractor.rb +1 -0
- data/lib/generators/graphql/input_generator.rb +1 -0
- data/lib/generators/graphql/install/mutation_root_generator.rb +1 -0
- data/lib/generators/graphql/install_generator.rb +1 -0
- data/lib/generators/graphql/interface_generator.rb +1 -0
- data/lib/generators/graphql/loader_generator.rb +1 -0
- data/lib/generators/graphql/mutation_create_generator.rb +1 -0
- data/lib/generators/graphql/mutation_delete_generator.rb +1 -0
- data/lib/generators/graphql/mutation_generator.rb +1 -0
- data/lib/generators/graphql/mutation_update_generator.rb +1 -0
- data/lib/generators/graphql/object_generator.rb +1 -0
- data/lib/generators/graphql/orm_mutations_base.rb +1 -0
- data/lib/generators/graphql/relay.rb +1 -0
- data/lib/generators/graphql/relay_generator.rb +1 -0
- data/lib/generators/graphql/scalar_generator.rb +1 -0
- data/lib/generators/graphql/templates/graphql_controller.erb +7 -1
- data/lib/generators/graphql/type_generator.rb +1 -0
- data/lib/generators/graphql/union_generator.rb +1 -0
- data/lib/graphql/analysis/analyzer.rb +1 -0
- data/lib/graphql/analysis/field_usage.rb +1 -0
- data/lib/graphql/analysis/max_query_complexity.rb +3 -1
- data/lib/graphql/analysis/max_query_depth.rb +3 -1
- data/lib/graphql/analysis/query_complexity.rb +7 -2
- data/lib/graphql/analysis/query_depth.rb +2 -1
- data/lib/graphql/analysis/visitor.rb +15 -2
- data/lib/graphql/analysis.rb +5 -5
- data/lib/graphql/analysis_error.rb +2 -1
- data/lib/graphql/autoload.rb +1 -0
- data/lib/graphql/backtrace/table.rb +1 -0
- data/lib/graphql/backtrace/traced_error.rb +1 -0
- data/lib/graphql/backtrace.rb +1 -0
- data/lib/graphql/coercion_error.rb +2 -1
- data/lib/graphql/current.rb +6 -1
- data/lib/graphql/dashboard/application_controller.rb +1 -0
- data/lib/graphql/dashboard/detailed_traces.rb +1 -0
- data/lib/graphql/dashboard/installable.rb +1 -0
- data/lib/graphql/dashboard/landings_controller.rb +1 -0
- data/lib/graphql/dashboard/limiters.rb +1 -0
- data/lib/graphql/dashboard/operation_store.rb +1 -0
- data/lib/graphql/dashboard/statics_controller.rb +1 -0
- data/lib/graphql/dashboard/subscriptions.rb +1 -0
- data/lib/graphql/dashboard.rb +2 -1
- data/lib/graphql/dataloader/active_record_association_source.rb +1 -0
- data/lib/graphql/dataloader/active_record_source.rb +1 -0
- data/lib/graphql/dataloader/async_dataloader.rb +1 -0
- data/lib/graphql/dataloader/null_dataloader.rb +1 -0
- data/lib/graphql/dataloader/request.rb +1 -0
- data/lib/graphql/dataloader/request_all.rb +1 -0
- data/lib/graphql/dataloader/source.rb +1 -0
- data/lib/graphql/dataloader.rb +1 -0
- data/lib/graphql/date_encoding_error.rb +4 -1
- data/lib/graphql/dig.rb +1 -0
- data/lib/graphql/duration_encoding_error.rb +4 -1
- data/lib/graphql/execution/directive_checks.rb +3 -1
- data/lib/graphql/execution/errors.rb +19 -7
- data/lib/graphql/execution/field_resolve_step.rb +4 -3
- data/lib/graphql/execution/finalize.rb +1 -0
- data/lib/graphql/execution/input_values.rb +196 -120
- data/lib/graphql/execution/interpreter/argument_value.rb +1 -0
- data/lib/graphql/execution/interpreter/arguments.rb +1 -0
- data/lib/graphql/execution/interpreter/arguments_cache.rb +1 -0
- data/lib/graphql/execution/interpreter/execution_errors.rb +7 -4
- data/lib/graphql/execution/interpreter/handles_raw_value.rb +6 -2
- data/lib/graphql/execution/interpreter/resolve.rb +6 -2
- data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +1 -0
- data/lib/graphql/execution/interpreter/runtime.rb +14 -8
- data/lib/graphql/execution/interpreter.rb +7 -4
- data/lib/graphql/execution/lazy/lazy_method_map.rb +1 -0
- data/lib/graphql/execution/lazy.rb +1 -0
- data/lib/graphql/execution/load_argument_step.rb +1 -0
- data/lib/graphql/execution/lookahead.rb +21 -8
- data/lib/graphql/execution/multiplex.rb +1 -0
- data/lib/graphql/execution/next.rb +2 -0
- data/lib/graphql/execution/prepare_object_step.rb +3 -5
- data/lib/graphql/execution/resolve_type_step.rb +1 -0
- data/lib/graphql/execution/runner.rb +21 -12
- data/lib/graphql/execution/selections_step.rb +2 -1
- data/lib/graphql/execution/variable_values.rb +262 -0
- data/lib/graphql/execution.rb +1 -0
- data/lib/graphql/execution_error.rb +1 -0
- data/lib/graphql/float_decoding_error.rb +4 -1
- data/lib/graphql/float_encoding_error.rb +1 -0
- data/lib/graphql/integer_decoding_error.rb +4 -1
- data/lib/graphql/integer_encoding_error.rb +1 -0
- data/lib/graphql/introspection/base_object.rb +2 -1
- data/lib/graphql/introspection/directive_location_enum.rb +2 -1
- data/lib/graphql/introspection/directive_type.rb +4 -1
- data/lib/graphql/introspection/dynamic_fields.rb +4 -1
- data/lib/graphql/introspection/entry_points.rb +1 -0
- data/lib/graphql/introspection/enum_value_type.rb +4 -1
- data/lib/graphql/introspection/field_type.rb +6 -1
- data/lib/graphql/introspection/input_value_type.rb +1 -0
- data/lib/graphql/introspection/introspection_query.rb +10 -7
- data/lib/graphql/introspection/schema_type.rb +1 -0
- data/lib/graphql/introspection/type_kind_enum.rb +2 -1
- data/lib/graphql/introspection/type_type.rb +1 -0
- data/lib/graphql/introspection.rb +3 -1
- data/lib/graphql/invalid_name_error.rb +1 -0
- data/lib/graphql/invalid_null_error.rb +1 -0
- data/lib/graphql/language/block_string.rb +12 -5
- data/lib/graphql/language/cache.rb +1 -0
- data/lib/graphql/language/comment.rb +3 -1
- data/lib/graphql/language/definition_slice.rb +1 -0
- data/lib/graphql/language/document_from_schema_definition.rb +1 -0
- data/lib/graphql/language/generation.rb +3 -1
- data/lib/graphql/language/lexer.rb +33 -25
- data/lib/graphql/language/nodes.rb +1 -0
- data/lib/graphql/language/parser.rb +11 -7
- data/lib/graphql/language/printer.rb +1 -0
- data/lib/graphql/language/sanitized_printer.rb +1 -0
- data/lib/graphql/language/static_visitor.rb +1 -0
- data/lib/graphql/language/visitor.rb +1 -0
- data/lib/graphql/language.rb +2 -1
- data/lib/graphql/load_application_object_failed_error.rb +1 -0
- data/lib/graphql/name_validator.rb +3 -1
- data/lib/graphql/pagination/active_record_relation_connection.rb +9 -1
- data/lib/graphql/pagination/array_connection.rb +1 -0
- data/lib/graphql/pagination/connection.rb +1 -0
- data/lib/graphql/pagination/connections.rb +1 -0
- data/lib/graphql/pagination/mongoid_relation_connection.rb +6 -1
- data/lib/graphql/pagination/relation_connection.rb +5 -4
- data/lib/graphql/pagination/sequel_dataset_connection.rb +6 -1
- data/lib/graphql/pagination.rb +2 -1
- data/lib/graphql/parse_error.rb +1 -0
- data/lib/graphql/query/context/scoped_context.rb +1 -0
- data/lib/graphql/query/context.rb +1 -0
- data/lib/graphql/query/fingerprint.rb +3 -1
- data/lib/graphql/query/input_validation_result.rb +44 -0
- data/lib/graphql/query/null_context.rb +1 -0
- data/lib/graphql/query/partial.rb +5 -0
- data/lib/graphql/query/result.rb +1 -0
- data/lib/graphql/query/validation_pipeline.rb +1 -0
- data/lib/graphql/query/variable_validation_error.rb +1 -0
- data/lib/graphql/query.rb +9 -12
- data/lib/graphql/railtie.rb +2 -1
- data/lib/graphql/rake_task/validate.rb +1 -0
- data/lib/graphql/rake_task.rb +1 -0
- data/lib/graphql/relay/range_add.rb +1 -0
- data/lib/graphql/relay.rb +2 -1
- data/lib/graphql/rubocop/graphql/base_cop.rb +1 -0
- data/lib/graphql/rubocop/graphql/default_null_true.rb +1 -0
- data/lib/graphql/rubocop/graphql/default_required_true.rb +1 -0
- data/lib/graphql/rubocop/graphql/field_type_in_block.rb +1 -0
- data/lib/graphql/rubocop/graphql/root_types_in_block.rb +1 -0
- data/lib/graphql/rubocop.rb +2 -1
- data/lib/graphql/runtime_error.rb +2 -1
- data/lib/graphql/runtime_type_error.rb +2 -1
- data/lib/graphql/schema/addition.rb +1 -0
- data/lib/graphql/schema/always_visible.rb +4 -1
- data/lib/graphql/schema/argument.rb +1 -0
- data/lib/graphql/schema/base_64_encoder.rb +4 -1
- data/lib/graphql/schema/build_from_definition/resolve_map/default_resolve.rb +6 -3
- data/lib/graphql/schema/build_from_definition/resolve_map.rb +1 -0
- data/lib/graphql/schema/build_from_definition.rb +1 -0
- data/lib/graphql/schema/built_in_types.rb +3 -2
- data/lib/graphql/schema/directive/deprecated.rb +2 -1
- data/lib/graphql/schema/directive/feature.rb +1 -0
- data/lib/graphql/schema/directive/flagged.rb +5 -1
- data/lib/graphql/schema/directive/include.rb +3 -1
- data/lib/graphql/schema/directive/one_of.rb +5 -2
- data/lib/graphql/schema/directive/skip.rb +3 -1
- data/lib/graphql/schema/directive/specified_by.rb +2 -1
- data/lib/graphql/schema/directive/transform.rb +9 -4
- data/lib/graphql/schema/directive.rb +1 -0
- data/lib/graphql/schema/enum.rb +1 -0
- data/lib/graphql/schema/enum_value.rb +1 -0
- data/lib/graphql/schema/field/connection_extension.rb +6 -2
- data/lib/graphql/schema/field/scope_extension.rb +3 -1
- data/lib/graphql/schema/field.rb +4 -0
- data/lib/graphql/schema/field_extension.rb +1 -0
- data/lib/graphql/schema/find_inherited_value.rb +6 -1
- data/lib/graphql/schema/finder.rb +1 -0
- data/lib/graphql/schema/has_single_input_argument.rb +1 -0
- data/lib/graphql/schema/input_object.rb +1 -0
- data/lib/graphql/schema/interface.rb +1 -0
- data/lib/graphql/schema/introspection_system.rb +1 -0
- data/lib/graphql/schema/late_bound_type.rb +1 -0
- data/lib/graphql/schema/list.rb +1 -0
- data/lib/graphql/schema/loader.rb +1 -0
- data/lib/graphql/schema/member/base_dsl_methods.rb +1 -0
- data/lib/graphql/schema/member/build_type.rb +1 -0
- data/lib/graphql/schema/member/graphql_type_names.rb +2 -1
- data/lib/graphql/schema/member/has_arguments.rb +1 -0
- data/lib/graphql/schema/member/has_ast_node.rb +7 -2
- data/lib/graphql/schema/member/has_authorization.rb +7 -4
- data/lib/graphql/schema/member/has_dataloader.rb +1 -0
- data/lib/graphql/schema/member/has_deprecation_reason.rb +7 -2
- data/lib/graphql/schema/member/has_directives.rb +21 -22
- data/lib/graphql/schema/member/has_fields.rb +1 -0
- data/lib/graphql/schema/member/has_interfaces.rb +1 -0
- data/lib/graphql/schema/member/has_path.rb +3 -1
- data/lib/graphql/schema/member/has_unresolved_type_error.rb +3 -1
- data/lib/graphql/schema/member/has_validators.rb +1 -0
- data/lib/graphql/schema/member/relay_shortcuts.rb +1 -0
- data/lib/graphql/schema/member/scoped.rb +7 -3
- data/lib/graphql/schema/member/type_system_helpers.rb +1 -0
- data/lib/graphql/schema/member/validates_input.rb +7 -1
- data/lib/graphql/schema/member.rb +4 -2
- data/lib/graphql/schema/mutation.rb +7 -1
- data/lib/graphql/schema/non_null.rb +1 -0
- data/lib/graphql/schema/object.rb +2 -1
- data/lib/graphql/schema/printer.rb +1 -0
- data/lib/graphql/schema/ractor_shareable.rb +1 -0
- data/lib/graphql/schema/relay_classic_mutation.rb +8 -3
- data/lib/graphql/schema/resolver/has_payload_type.rb +1 -0
- data/lib/graphql/schema/resolver.rb +5 -3
- data/lib/graphql/schema/scalar.rb +27 -3
- data/lib/graphql/schema/subscription.rb +1 -0
- data/lib/graphql/schema/timeout.rb +1 -0
- data/lib/graphql/schema/type_expression.rb +4 -1
- data/lib/graphql/schema/type_membership.rb +1 -0
- data/lib/graphql/schema/union.rb +1 -0
- data/lib/graphql/schema/unique_within_type.rb +1 -0
- data/lib/graphql/schema/validator/all_validator.rb +7 -3
- data/lib/graphql/schema/validator/allow_blank_validator.rb +5 -2
- data/lib/graphql/schema/validator/allow_null_validator.rb +6 -3
- data/lib/graphql/schema/validator/exclusion_validator.rb +7 -4
- data/lib/graphql/schema/validator/format_validator.rb +7 -4
- data/lib/graphql/schema/validator/inclusion_validator.rb +6 -3
- data/lib/graphql/schema/validator/length_validator.rb +1 -0
- data/lib/graphql/schema/validator/numericality_validator.rb +1 -0
- data/lib/graphql/schema/validator/required_validator.rb +1 -0
- data/lib/graphql/schema/validator.rb +3 -2
- data/lib/graphql/schema/visibility/migration.rb +1 -0
- data/lib/graphql/schema/visibility/profile.rb +1 -0
- data/lib/graphql/schema/visibility/visit.rb +1 -0
- data/lib/graphql/schema/visibility.rb +1 -0
- data/lib/graphql/schema/warden.rb +1 -0
- data/lib/graphql/schema/wrapper.rb +1 -0
- data/lib/graphql/schema.rb +1 -0
- data/lib/graphql/static_validation/all_rules.rb +2 -1
- data/lib/graphql/static_validation/base_visitor.rb +126 -53
- data/lib/graphql/static_validation/definition_dependencies.rb +15 -2
- data/lib/graphql/static_validation/error.rb +14 -5
- data/lib/graphql/static_validation/interpreter_visitor.rb +2 -1
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +9 -3
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb +16 -8
- data/lib/graphql/static_validation/rules/argument_names_are_unique.rb +5 -1
- data/lib/graphql/static_validation/rules/argument_names_are_unique_error.rb +8 -3
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +10 -4
- data/lib/graphql/static_validation/rules/arguments_are_defined_error.rb +14 -6
- data/lib/graphql/static_validation/rules/directives_are_defined.rb +7 -9
- data/lib/graphql/static_validation/rules/directives_are_defined_error.rb +8 -3
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +14 -7
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations_error.rb +10 -4
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +9 -4
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type_error.rb +10 -4
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +1 -0
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections_error.rb +10 -4
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +2 -3
- data/lib/graphql/static_validation/rules/fields_will_merge_error.rb +15 -4
- data/lib/graphql/static_validation/rules/fragment_names_are_unique.rb +10 -5
- data/lib/graphql/static_validation/rules/fragment_names_are_unique_error.rb +8 -3
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +30 -14
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible_error.rb +12 -5
- data/lib/graphql/static_validation/rules/fragment_types_exist.rb +11 -6
- data/lib/graphql/static_validation/rules/fragment_types_exist_error.rb +8 -3
- data/lib/graphql/static_validation/rules/fragments_are_finite.rb +3 -1
- data/lib/graphql/static_validation/rules/fragments_are_finite_error.rb +8 -3
- data/lib/graphql/static_validation/rules/fragments_are_named.rb +3 -1
- data/lib/graphql/static_validation/rules/fragments_are_named_error.rb +5 -1
- data/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +7 -3
- data/lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb +8 -4
- data/lib/graphql/static_validation/rules/fragments_are_used.rb +3 -1
- data/lib/graphql/static_validation/rules/fragments_are_used_error.rb +8 -3
- data/lib/graphql/static_validation/rules/input_object_names_are_unique.rb +4 -1
- data/lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb +8 -3
- data/lib/graphql/static_validation/rules/mutation_root_exists.rb +4 -2
- data/lib/graphql/static_validation/rules/mutation_root_exists_error.rb +5 -1
- data/lib/graphql/static_validation/rules/no_definitions_are_present.rb +7 -3
- data/lib/graphql/static_validation/rules/no_definitions_are_present_error.rb +5 -1
- data/lib/graphql/static_validation/rules/not_single_subscription_error.rb +5 -1
- data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb +19 -6
- data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb +7 -2
- data/lib/graphql/static_validation/rules/operation_names_are_valid.rb +10 -4
- data/lib/graphql/static_validation/rules/operation_names_are_valid_error.rb +7 -2
- data/lib/graphql/static_validation/rules/query_root_exists.rb +4 -2
- data/lib/graphql/static_validation/rules/query_root_exists_error.rb +5 -1
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +19 -10
- data/lib/graphql/static_validation/rules/required_arguments_are_present_error.rb +12 -5
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +5 -1
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present_error.rb +11 -4
- data/lib/graphql/static_validation/rules/subscription_root_exists_and_single_subscription_selection.rb +9 -6
- data/lib/graphql/static_validation/rules/subscription_root_exists_error.rb +5 -1
- data/lib/graphql/static_validation/rules/unique_directives_per_location.rb +7 -5
- data/lib/graphql/static_validation/rules/unique_directives_per_location_error.rb +8 -3
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +3 -1
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed_error.rb +13 -6
- data/lib/graphql/static_validation/rules/variable_names_are_unique.rb +3 -1
- data/lib/graphql/static_validation/rules/variable_names_are_unique_error.rb +8 -3
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +17 -9
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed_error.rb +14 -6
- data/lib/graphql/static_validation/rules/variables_are_input_types.rb +9 -6
- data/lib/graphql/static_validation/rules/variables_are_input_types_error.rb +10 -4
- data/lib/graphql/static_validation/rules/variables_are_used_and_defined.rb +1 -0
- data/lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb +11 -5
- data/lib/graphql/static_validation/validation_context.rb +52 -14
- data/lib/graphql/static_validation/validation_timeout_error.rb +5 -1
- data/lib/graphql/static_validation/validator.rb +7 -3
- data/lib/graphql/static_validation.rb +2 -2
- data/lib/graphql/string_encoding_error.rb +1 -0
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +15 -13
- data/lib/graphql/subscriptions/broadcast_analyzer.rb +1 -0
- data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +1 -0
- data/lib/graphql/subscriptions/event.rb +1 -0
- data/lib/graphql/subscriptions/serialize.rb +1 -0
- data/lib/graphql/subscriptions.rb +1 -0
- data/lib/graphql/testing/helpers.rb +1 -0
- data/lib/graphql/testing/mock_action_cable.rb +1 -0
- data/lib/graphql/testing.rb +2 -1
- data/lib/graphql/tracing/active_support_notifications_trace.rb +1 -0
- data/lib/graphql/tracing/active_support_notifications_tracing.rb +1 -0
- data/lib/graphql/tracing/appoptics_trace.rb +1 -0
- data/lib/graphql/tracing/appoptics_tracing.rb +1 -0
- data/lib/graphql/tracing/appsignal_trace.rb +1 -0
- data/lib/graphql/tracing/appsignal_tracing.rb +1 -0
- data/lib/graphql/tracing/call_legacy_tracers.rb +1 -0
- data/lib/graphql/tracing/data_dog_trace.rb +1 -0
- data/lib/graphql/tracing/data_dog_tracing.rb +1 -0
- data/lib/graphql/tracing/detailed_trace/active_record_backend.rb +1 -0
- data/lib/graphql/tracing/detailed_trace/memory_backend.rb +1 -0
- data/lib/graphql/tracing/detailed_trace/redis_backend.rb +1 -0
- data/lib/graphql/tracing/detailed_trace.rb +1 -0
- data/lib/graphql/tracing/legacy_hooks_trace.rb +1 -0
- data/lib/graphql/tracing/legacy_trace.rb +2 -1
- data/lib/graphql/tracing/monitor_trace.rb +1 -0
- data/lib/graphql/tracing/new_relic_trace.rb +1 -0
- data/lib/graphql/tracing/new_relic_tracing.rb +1 -0
- data/lib/graphql/tracing/notifications_trace.rb +1 -0
- data/lib/graphql/tracing/notifications_tracing.rb +1 -0
- data/lib/graphql/tracing/null_trace.rb +2 -1
- data/lib/graphql/tracing/perfetto_trace/trace_pb.rb +1 -0
- data/lib/graphql/tracing/perfetto_trace.rb +1 -0
- data/lib/graphql/tracing/platform_trace.rb +1 -0
- data/lib/graphql/tracing/platform_tracing.rb +1 -0
- data/lib/graphql/tracing/prometheus_trace/graphql_collector.rb +1 -0
- data/lib/graphql/tracing/prometheus_trace.rb +1 -0
- data/lib/graphql/tracing/prometheus_tracing.rb +1 -0
- data/lib/graphql/tracing/scout_trace.rb +1 -0
- data/lib/graphql/tracing/scout_tracing.rb +1 -0
- data/lib/graphql/tracing/sentry_trace.rb +1 -0
- data/lib/graphql/tracing/statsd_trace.rb +1 -0
- data/lib/graphql/tracing/statsd_tracing.rb +1 -0
- data/lib/graphql/tracing/trace.rb +1 -0
- data/lib/graphql/tracing.rb +1 -0
- data/lib/graphql/type_kinds.rb +1 -0
- data/lib/graphql/types/big_int.rb +5 -1
- data/lib/graphql/types/boolean.rb +4 -1
- data/lib/graphql/types/float.rb +4 -1
- data/lib/graphql/types/id.rb +4 -1
- data/lib/graphql/types/int.rb +6 -3
- data/lib/graphql/types/iso_8601_date.rb +4 -1
- data/lib/graphql/types/iso_8601_date_time.rb +7 -2
- data/lib/graphql/types/iso_8601_duration.rb +7 -2
- data/lib/graphql/types/json.rb +4 -1
- data/lib/graphql/types/relay/base_connection.rb +2 -1
- data/lib/graphql/types/relay/base_edge.rb +2 -1
- data/lib/graphql/types/relay/connection_behaviors.rb +1 -2
- data/lib/graphql/types/relay/edge_behaviors.rb +1 -2
- data/lib/graphql/types/relay/has_node_field.rb +7 -1
- data/lib/graphql/types/relay/has_nodes_field.rb +7 -1
- data/lib/graphql/types/relay/node.rb +2 -1
- data/lib/graphql/types/relay/node_behaviors.rb +7 -1
- data/lib/graphql/types/relay/page_info.rb +2 -1
- data/lib/graphql/types/relay/page_info_behaviors.rb +5 -1
- data/lib/graphql/types/relay.rb +2 -1
- data/lib/graphql/types/string.rb +4 -1
- data/lib/graphql/types.rb +2 -1
- data/lib/graphql/unauthorized_enum_value_error.rb +1 -0
- data/lib/graphql/unauthorized_error.rb +1 -0
- data/lib/graphql/unauthorized_field_error.rb +1 -0
- data/lib/graphql/unresolved_type_error.rb +1 -0
- data/lib/graphql/version.rb +3 -2
- data/lib/graphql.rb +1 -0
- metadata +3 -4
- data/lib/graphql/query/variables.rb +0 -99
- data/lib/graphql/static_validation/literal_validator.rb +0 -157
data/lib/graphql/types/id.rb
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
module GraphQL
|
|
4
5
|
module Types
|
|
5
6
|
class ID < GraphQL::Schema::Scalar
|
|
6
7
|
graphql_name "ID"
|
|
7
8
|
description "Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"VXNlci0xMA==\"`) or integer (such as `4`) input value will be accepted as an ID."
|
|
8
9
|
default_scalar true
|
|
10
|
+
#: (untyped value, GraphQL::Query::Context _ctx) -> ::String
|
|
9
11
|
def self.coerce_result(value, _ctx)
|
|
10
12
|
value.is_a?(::String) ? value : value.to_s
|
|
11
13
|
end
|
|
12
14
|
|
|
15
|
+
#: (untyped value, GraphQL::Query::Context _ctx) -> ::String?
|
|
13
16
|
def self.coerce_input(value, _ctx)
|
|
14
17
|
case value
|
|
15
18
|
when ::String
|
data/lib/graphql/types/int.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
|
|
4
5
|
module GraphQL
|
|
5
6
|
module Types
|
|
@@ -7,9 +8,10 @@ module GraphQL
|
|
|
7
8
|
class Int < GraphQL::Schema::Scalar
|
|
8
9
|
description "Represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1."
|
|
9
10
|
|
|
10
|
-
MIN = -(
|
|
11
|
-
MAX = (
|
|
11
|
+
MIN = -(1 << 31) #: Integer
|
|
12
|
+
MAX = (1 << 31) - 1 #: Integer
|
|
12
13
|
|
|
14
|
+
#: (untyped value, GraphQL::Query::Context ctx) -> untyped
|
|
13
15
|
def self.coerce_input(value, ctx)
|
|
14
16
|
return if !value.is_a?(Integer)
|
|
15
17
|
|
|
@@ -21,6 +23,7 @@ module GraphQL
|
|
|
21
23
|
end
|
|
22
24
|
end
|
|
23
25
|
|
|
26
|
+
#: (untyped value, GraphQL::Query::Context ctx) -> untyped
|
|
24
27
|
def self.coerce_result(value, ctx)
|
|
25
28
|
value = value.to_i
|
|
26
29
|
if value >= MIN && value <= MAX
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
module GraphQL
|
|
4
5
|
module Types
|
|
5
6
|
# This scalar takes `Date`s and transmits them as strings,
|
|
@@ -27,6 +28,7 @@ module GraphQL
|
|
|
27
28
|
#
|
|
28
29
|
# :call-seq:
|
|
29
30
|
# coerce_result(Date | Time | DateTime | String value, _ctx) -> String
|
|
31
|
+
#: (untyped value, GraphQL::Query::Context _ctx) -> ::String
|
|
30
32
|
def self.coerce_result(value, _ctx)
|
|
31
33
|
Date.parse(value.to_s).iso8601
|
|
32
34
|
end
|
|
@@ -41,6 +43,7 @@ module GraphQL
|
|
|
41
43
|
#
|
|
42
44
|
# :call-seq:
|
|
43
45
|
# coerce_input(value, ctx) -> Date | nil
|
|
46
|
+
#: (untyped value, GraphQL::Query::Context ctx) -> untyped
|
|
44
47
|
def self.coerce_input(value, ctx)
|
|
45
48
|
if value.is_a?(::Date)
|
|
46
49
|
value
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
|
|
4
5
|
require 'time'
|
|
5
6
|
|
|
@@ -30,6 +31,7 @@ module GraphQL
|
|
|
30
31
|
#
|
|
31
32
|
# :call-seq:
|
|
32
33
|
# time_precision() -> Integer
|
|
34
|
+
#: -> Integer
|
|
33
35
|
def self.time_precision
|
|
34
36
|
@time_precision || DEFAULT_TIME_PRECISION
|
|
35
37
|
end
|
|
@@ -40,8 +42,9 @@ module GraphQL
|
|
|
40
42
|
#
|
|
41
43
|
# :call-seq:
|
|
42
44
|
# time_precision=(Integer value)
|
|
45
|
+
#: (Integer value) -> void
|
|
43
46
|
def self.time_precision=(value)
|
|
44
|
-
@time_precision = value
|
|
47
|
+
@time_precision = value #: Integer?
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
# **Parameters**
|
|
@@ -54,6 +57,7 @@ module GraphQL
|
|
|
54
57
|
#
|
|
55
58
|
# :call-seq:
|
|
56
59
|
# coerce_result(Time | Date | DateTime | String value, _ctx) -> String
|
|
60
|
+
#: (untyped value, GraphQL::Query::Context _ctx) -> ::String
|
|
57
61
|
def self.coerce_result(value, _ctx)
|
|
58
62
|
case value
|
|
59
63
|
when Date
|
|
@@ -78,6 +82,7 @@ module GraphQL
|
|
|
78
82
|
#
|
|
79
83
|
# :call-seq:
|
|
80
84
|
# coerce_input(String str_value, _ctx) -> Time
|
|
85
|
+
#: (untyped str_value, GraphQL::Query::Context _ctx) -> ::Time?
|
|
81
86
|
def self.coerce_input(str_value, _ctx)
|
|
82
87
|
Time.iso8601(str_value)
|
|
83
88
|
rescue ArgumentError, TypeError
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
module GraphQL
|
|
4
5
|
module Types
|
|
5
6
|
# This scalar takes `Duration`s and transmits them as strings,
|
|
@@ -23,6 +24,7 @@ module GraphQL
|
|
|
23
24
|
#
|
|
24
25
|
# :call-seq:
|
|
25
26
|
# seconds_precision() -> Integer | nil
|
|
27
|
+
#: -> Integer?
|
|
26
28
|
def self.seconds_precision
|
|
27
29
|
# ActiveSupport::Duration precision defaults to whatever input was given
|
|
28
30
|
@seconds_precision
|
|
@@ -34,8 +36,9 @@ module GraphQL
|
|
|
34
36
|
#
|
|
35
37
|
# :call-seq:
|
|
36
38
|
# seconds_precision=(Integer | nil value)
|
|
39
|
+
#: (Integer? value) -> Integer?
|
|
37
40
|
def self.seconds_precision=(value)
|
|
38
|
-
@seconds_precision = value
|
|
41
|
+
@seconds_precision = value #: Integer?
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
# **Parameters**
|
|
@@ -52,6 +55,7 @@ module GraphQL
|
|
|
52
55
|
#
|
|
53
56
|
# :call-seq:
|
|
54
57
|
# coerce_result(ActiveSupport::Duration | String value, _ctx) -> String | GraphQL::Error
|
|
58
|
+
#: (untyped value, GraphQL::Query::Context _ctx) -> ::String
|
|
55
59
|
def self.coerce_result(value, _ctx)
|
|
56
60
|
unless defined?(ActiveSupport::Duration)
|
|
57
61
|
raise GraphQL::Error, "ActiveSupport >= 5.0 must be loaded to use the built-in ISO8601Duration type."
|
|
@@ -87,6 +91,7 @@ module GraphQL
|
|
|
87
91
|
#
|
|
88
92
|
# :call-seq:
|
|
89
93
|
# coerce_input(String | ActiveSupport::Duration value, ctx) -> ActiveSupport::Duration | nil | GraphQL::Error | GraphQL::DurationEncodingError
|
|
94
|
+
#: (untyped value, GraphQL::Query::Context ctx) -> untyped
|
|
90
95
|
def self.coerce_input(value, ctx)
|
|
91
96
|
unless defined?(ActiveSupport::Duration)
|
|
92
97
|
raise GraphQL::Error, "ActiveSupport >= 5.0 must be loaded to use the built-in ISO8601Duration type."
|
data/lib/graphql/types/json.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
module GraphQL
|
|
4
5
|
module Types
|
|
5
6
|
# An untyped JSON scalar that maps to Ruby hashes, arrays, strings, integers, floats, booleans and nils.
|
|
@@ -14,10 +15,12 @@ module GraphQL
|
|
|
14
15
|
class JSON < GraphQL::Schema::Scalar
|
|
15
16
|
description "Represents untyped JSON"
|
|
16
17
|
|
|
18
|
+
#: (untyped value, GraphQL::Query::Context _context) -> untyped
|
|
17
19
|
def self.coerce_input(value, _context)
|
|
18
20
|
value
|
|
19
21
|
end
|
|
20
22
|
|
|
23
|
+
#: (untyped value, GraphQL::Query::Context _context) -> untyped
|
|
21
24
|
def self.coerce_result(value, _context)
|
|
22
25
|
value
|
|
23
26
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
#--
|
|
2
3
|
# typed: true
|
|
3
4
|
|
|
4
5
|
module GraphQL
|
|
@@ -26,8 +27,6 @@ module GraphQL
|
|
|
26
27
|
add_page_info_field(child_class)
|
|
27
28
|
end
|
|
28
29
|
|
|
29
|
-
#--
|
|
30
|
-
# @requires_ancestor: singleton(GraphQL::Schema::Object)
|
|
31
30
|
module ClassMethods
|
|
32
31
|
def inherited(child_class)
|
|
33
32
|
super
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
#--
|
|
2
3
|
# typed: true
|
|
3
4
|
|
|
4
5
|
module GraphQL
|
|
@@ -27,8 +28,6 @@ module GraphQL
|
|
|
27
28
|
@object.node
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
#--
|
|
31
|
-
# @requires_ancestor: singleton(GraphQL::Schema::Object)
|
|
32
31
|
module ClassMethods
|
|
33
32
|
def inherited(child_class)
|
|
34
33
|
super
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
|
|
4
5
|
module GraphQL
|
|
5
6
|
module Types
|
|
@@ -8,23 +9,27 @@ module GraphQL
|
|
|
8
9
|
#--
|
|
9
10
|
# @requires_ancestor: GraphQL::Schema::Object
|
|
10
11
|
module HasNodeField
|
|
12
|
+
#: (singleton(GraphQL::Schema::Object) child_class) -> void
|
|
11
13
|
def self.included(child_class)
|
|
12
14
|
child_class.field(**field_options, &field_block)
|
|
13
15
|
child_class.extend(ExecutionMethods)
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
module ExecutionMethods
|
|
19
|
+
#: (GraphQL::Query::Context context, id: String) -> untyped
|
|
17
20
|
def get_relay_node(context, id:)
|
|
18
21
|
context.schema.object_from_id(id, context)
|
|
19
22
|
end
|
|
20
23
|
end
|
|
21
24
|
|
|
25
|
+
#: (id: String) -> untyped
|
|
22
26
|
def get_relay_node(id:)
|
|
23
27
|
query_class = self.class #: as GraphQL::Types::Relay::HasNodeField::ExecutionMethods
|
|
24
28
|
query_class.get_relay_node(context, id: id)
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
class << self
|
|
32
|
+
#: -> Hash[Symbol, untyped]
|
|
28
33
|
def field_options
|
|
29
34
|
{
|
|
30
35
|
name: "node",
|
|
@@ -37,6 +42,7 @@ module GraphQL
|
|
|
37
42
|
}
|
|
38
43
|
end
|
|
39
44
|
|
|
45
|
+
#: -> untyped
|
|
40
46
|
def field_block
|
|
41
47
|
Proc.new {
|
|
42
48
|
#: self as GraphQL::Schema::Field
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
|
|
4
5
|
module GraphQL
|
|
5
6
|
module Types
|
|
@@ -8,23 +9,27 @@ module GraphQL
|
|
|
8
9
|
#--
|
|
9
10
|
# @requires_ancestor: GraphQL::Schema::Object
|
|
10
11
|
module HasNodesField
|
|
12
|
+
#: (singleton(GraphQL::Schema::Object) child_class) -> void
|
|
11
13
|
def self.included(child_class)
|
|
12
14
|
child_class.field(**field_options, &field_block)
|
|
13
15
|
child_class.extend(ExecutionMethods)
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
module ExecutionMethods
|
|
19
|
+
#: (GraphQL::Query::Context context, ids: Array[String]) -> untyped
|
|
17
20
|
def get_relay_nodes(context, ids:)
|
|
18
21
|
ids.map { |id| context.schema.object_from_id(id, context) }
|
|
19
22
|
end
|
|
20
23
|
end
|
|
21
24
|
|
|
25
|
+
#: (ids: Array[String]) -> untyped
|
|
22
26
|
def get_relay_nodes(ids:)
|
|
23
27
|
query_class = self.class #: as GraphQL::Types::Relay::HasNodesField::ExecutionMethods
|
|
24
28
|
query_class.get_relay_nodes(context, ids: ids)
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
class << self
|
|
32
|
+
#: -> Hash[Symbol, untyped]
|
|
28
33
|
def field_options
|
|
29
34
|
{
|
|
30
35
|
name: "nodes",
|
|
@@ -37,6 +42,7 @@ module GraphQL
|
|
|
37
42
|
}
|
|
38
43
|
end
|
|
39
44
|
|
|
45
|
+
#: -> untyped
|
|
40
46
|
def field_block
|
|
41
47
|
Proc.new {
|
|
42
48
|
#: self as GraphQL::Schema::Field
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
|
|
4
5
|
module GraphQL
|
|
5
6
|
module Types
|
|
@@ -7,6 +8,7 @@ module GraphQL
|
|
|
7
8
|
#--
|
|
8
9
|
# @requires_ancestor: GraphQL::Schema::Object
|
|
9
10
|
module NodeBehaviors
|
|
11
|
+
#: (GraphQL::Schema::Member::interface_definition child_module) -> void
|
|
10
12
|
def self.included(child_module)
|
|
11
13
|
child_module.extend(ClassMethods)
|
|
12
14
|
child_module.extend(ExecutionMethods)
|
|
@@ -14,22 +16,26 @@ module GraphQL
|
|
|
14
16
|
child_module.field(:id, ID, null: false, description: "ID of the object.", resolver_method: :default_global_id, resolve_each: :default_global_id)
|
|
15
17
|
end
|
|
16
18
|
|
|
19
|
+
#: -> String
|
|
17
20
|
def default_global_id
|
|
18
21
|
node_class = self.class #: as GraphQL::Types::Relay::NodeBehaviors::ExecutionMethods
|
|
19
22
|
node_class.default_global_id(object, context)
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
module ClassMethods
|
|
26
|
+
#: -> bool
|
|
23
27
|
def default_relay?
|
|
24
28
|
true
|
|
25
29
|
end
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
module ExecutionMethods
|
|
33
|
+
#: (untyped object, GraphQL::Query::Context context) -> String
|
|
29
34
|
def default_global_id(object, context)
|
|
30
35
|
context.schema.id_from_object(object, self, context)
|
|
31
36
|
end
|
|
32
37
|
|
|
38
|
+
#: (Module[untyped] child_class) -> void
|
|
33
39
|
def included(child_class)
|
|
34
40
|
child_class.extend(ExecutionMethods)
|
|
35
41
|
end
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
module GraphQL
|
|
4
5
|
module Types
|
|
5
6
|
module Relay
|
|
6
7
|
module PageInfoBehaviors
|
|
8
|
+
#: (singleton(GraphQL::Schema::Object) child_class) -> void
|
|
7
9
|
def self.included(child_class)
|
|
8
10
|
child_class.extend ClassMethods
|
|
9
11
|
child_class.description "Information about pagination in a connection."
|
|
@@ -22,10 +24,12 @@ module GraphQL
|
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
module ClassMethods
|
|
27
|
+
#: () -> bool
|
|
25
28
|
def default_relay?
|
|
26
29
|
true
|
|
27
30
|
end
|
|
28
31
|
|
|
32
|
+
#: () -> bool
|
|
29
33
|
def default_broadcastable?
|
|
30
34
|
true
|
|
31
35
|
end
|
data/lib/graphql/types/relay.rb
CHANGED
data/lib/graphql/types/string.rb
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
#--
|
|
3
|
+
# typed: strict
|
|
3
4
|
|
|
4
5
|
module GraphQL
|
|
5
6
|
module Types
|
|
6
7
|
class String < GraphQL::Schema::Scalar
|
|
7
8
|
description "Represents textual data as UTF-8 character sequences. This type is most often used by GraphQL to represent free-form human-readable text."
|
|
8
9
|
|
|
10
|
+
#: (untyped value, GraphQL::Query::Context ctx) -> untyped
|
|
9
11
|
def self.coerce_result(value, ctx)
|
|
10
12
|
str = value.to_s
|
|
11
13
|
if str.encoding == Encoding::UTF_8 || str.ascii_only?
|
|
@@ -20,6 +22,7 @@ module GraphQL
|
|
|
20
22
|
ctx.schema.type_error(err, ctx)
|
|
21
23
|
end
|
|
22
24
|
|
|
25
|
+
#: (untyped value, GraphQL::Query::Context _ctx) -> ::String?
|
|
23
26
|
def self.coerce_input(value, _ctx)
|
|
24
27
|
value.is_a?(::String) ? value : nil
|
|
25
28
|
end
|
data/lib/graphql/types.rb
CHANGED
data/lib/graphql/version.rb
CHANGED
data/lib/graphql.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphql
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.6.
|
|
4
|
+
version: 2.6.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Mosolgo
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-11-17 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|
|
@@ -543,6 +543,7 @@ files:
|
|
|
543
543
|
- lib/graphql/execution/resolve_type_step.rb
|
|
544
544
|
- lib/graphql/execution/runner.rb
|
|
545
545
|
- lib/graphql/execution/selections_step.rb
|
|
546
|
+
- lib/graphql/execution/variable_values.rb
|
|
546
547
|
- lib/graphql/execution_error.rb
|
|
547
548
|
- lib/graphql/float_decoding_error.rb
|
|
548
549
|
- lib/graphql/float_encoding_error.rb
|
|
@@ -598,7 +599,6 @@ files:
|
|
|
598
599
|
- lib/graphql/query/result.rb
|
|
599
600
|
- lib/graphql/query/validation_pipeline.rb
|
|
600
601
|
- lib/graphql/query/variable_validation_error.rb
|
|
601
|
-
- lib/graphql/query/variables.rb
|
|
602
602
|
- lib/graphql/railtie.rb
|
|
603
603
|
- lib/graphql/rake_task.rb
|
|
604
604
|
- lib/graphql/rake_task/validate.rb
|
|
@@ -701,7 +701,6 @@ files:
|
|
|
701
701
|
- lib/graphql/static_validation/definition_dependencies.rb
|
|
702
702
|
- lib/graphql/static_validation/error.rb
|
|
703
703
|
- lib/graphql/static_validation/interpreter_visitor.rb
|
|
704
|
-
- lib/graphql/static_validation/literal_validator.rb
|
|
705
704
|
- lib/graphql/static_validation/rules/argument_literals_are_compatible.rb
|
|
706
705
|
- lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb
|
|
707
706
|
- lib/graphql/static_validation/rules/argument_names_are_unique.rb
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# typed: true
|
|
3
|
-
module GraphQL
|
|
4
|
-
class Query
|
|
5
|
-
# Read-only access to query variables, applying default values if needed.
|
|
6
|
-
class Variables
|
|
7
|
-
extend Forwardable
|
|
8
|
-
|
|
9
|
-
# **Returns**
|
|
10
|
-
#
|
|
11
|
-
# - `Array<GraphQL::Query::VariableValidationError>` — Any errors encountered when parsing the provided variables and literal values
|
|
12
|
-
attr_reader :errors
|
|
13
|
-
|
|
14
|
-
attr_reader :context
|
|
15
|
-
|
|
16
|
-
def initialize(ctx, ast_variables, provided_variables)
|
|
17
|
-
schema = ctx.schema
|
|
18
|
-
@context = ctx
|
|
19
|
-
|
|
20
|
-
@provided_variables = deep_stringify(provided_variables)
|
|
21
|
-
@errors = []
|
|
22
|
-
@storage = ast_variables.each_with_object({}) do |ast_variable, memo|
|
|
23
|
-
if schema.validate_max_errors && schema.validate_max_errors <= @errors.count
|
|
24
|
-
add_max_errors_reached_message
|
|
25
|
-
break memo
|
|
26
|
-
end
|
|
27
|
-
# Find the right value for this variable:
|
|
28
|
-
# - First, use the value provided at runtime
|
|
29
|
-
# - Then, fall back to the default value from the query string
|
|
30
|
-
# If it's still nil, raise an error if it's required.
|
|
31
|
-
variable_type = schema.type_from_ast(ast_variable.type, context: ctx)
|
|
32
|
-
if variable_type.nil? || !variable_type.unwrap.kind.input?
|
|
33
|
-
# Pass -- it will get handled by a validator
|
|
34
|
-
else
|
|
35
|
-
variable_name = ast_variable.name
|
|
36
|
-
default_value = ast_variable.default_value
|
|
37
|
-
provided_value = @provided_variables[variable_name]
|
|
38
|
-
value_was_provided = @provided_variables.key?(variable_name)
|
|
39
|
-
max_errors = schema.validate_max_errors - @errors.count if schema.validate_max_errors
|
|
40
|
-
begin
|
|
41
|
-
validation_result = if value_was_provided || default_value.nil?
|
|
42
|
-
variable_type.validate_input(provided_value, ctx, max_errors: max_errors)
|
|
43
|
-
else
|
|
44
|
-
GraphQL::Query::InputValidationResult::VALID
|
|
45
|
-
end
|
|
46
|
-
if validation_result.valid?
|
|
47
|
-
if value_was_provided
|
|
48
|
-
# Add the variable if a value was provided
|
|
49
|
-
memo[variable_name] = provided_value
|
|
50
|
-
elsif default_value != nil
|
|
51
|
-
memo[variable_name] = if default_value.is_a?(Language::Nodes::NullValue)
|
|
52
|
-
nil
|
|
53
|
-
else
|
|
54
|
-
default_value
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
rescue GraphQL::ExecutionError => ex
|
|
59
|
-
# TODO: This should really include the path to the problematic node in the variable value
|
|
60
|
-
# like InputValidationResults generated by validate_non_null_input but unfortunately we don't
|
|
61
|
-
# have this information available in the coerce_input call chain. Note this path is the path
|
|
62
|
-
# that appears under errors.extensions.problems.path and NOT the result path under errors.path.
|
|
63
|
-
validation_result = GraphQL::Query::InputValidationResult.from_problem(ex.message)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
if !validation_result.valid?
|
|
67
|
-
@errors << GraphQL::Query::VariableValidationError.new(ast_variable, variable_type, provided_value, validation_result)
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def_delegators :@storage, :length, :key?, :[], :fetch, :to_h
|
|
74
|
-
|
|
75
|
-
private
|
|
76
|
-
|
|
77
|
-
def deep_stringify(val)
|
|
78
|
-
case val
|
|
79
|
-
when Array
|
|
80
|
-
val.map { |v| deep_stringify(v) }
|
|
81
|
-
when Hash
|
|
82
|
-
new_val = {}
|
|
83
|
-
val.each do |k, v|
|
|
84
|
-
new_val[k.to_s] = deep_stringify(v)
|
|
85
|
-
end
|
|
86
|
-
new_val
|
|
87
|
-
else
|
|
88
|
-
val
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def add_max_errors_reached_message
|
|
93
|
-
message = "Too many errors processing variables, max validation error limit reached. Execution aborted"
|
|
94
|
-
validation_result = GraphQL::Query::InputValidationResult.from_problem(message)
|
|
95
|
-
errors << GraphQL::Query::VariableValidationError.new(nil, nil, nil, validation_result, msg: message)
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|