Class: GraphQL::Query::ValidationPipeline Private
- Inherits:
-
Object
- Object
- GraphQL::Query::ValidationPipeline
- Defined in:
- lib/graphql/query/validation_pipeline.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Contain the validation pipeline and expose the results.
- Checks in #initialize:
- Rescue a ParseError, halt if there is one
- Check for selected operation, halt if not found
- Validate the AST, halt if errors
- Validate the variables, halt if errors
- Run query analyzers, halt if errors
#valid? is false if any of the above checks halted the pipeline.
Instance Attribute Summary collapse
- #max_complexity ⇒ Object readonly private
- #max_depth ⇒ Object readonly private
Instance Method Summary collapse
- #analyzers ⇒ Object private
-
#initialize(query:, validate:, parse_error:, operation_name_error:, max_depth:, max_complexity:) ⇒ ValidationPipeline
constructor
private
A new instance of ValidationPipeline.
-
#internal_representation ⇒ Hash<String, nil => GraphQL::InternalRepresentation::Node] Operation name -
private
Irep node pairs.
-
#valid? ⇒ Boolean
private
Does this query have errors that should prevent it from running?.
-
#validation_errors ⇒ Array<GraphQL::StaticValidation::Error, GraphQL::Query::VariableValidationError>
private
Static validation errors for the query string.
Constructor Details
#initialize(query:, validate:, parse_error:, operation_name_error:, max_depth:, max_complexity:) ⇒ ValidationPipeline
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ValidationPipeline.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/graphql/query/validation_pipeline.rb', line 19 def initialize(query:, validate:, parse_error:, operation_name_error:, max_depth:, max_complexity:) @validation_errors = [] @internal_representation = nil @validate = validate @parse_error = parse_error @operation_name_error = operation_name_error @query = query @schema = query.schema @max_depth = max_depth @max_complexity = max_complexity @has_validated = false end |
Instance Attribute Details
#max_complexity ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/graphql/query/validation_pipeline.rb', line 17 def max_complexity @max_complexity end |
#max_depth ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/graphql/query/validation_pipeline.rb', line 17 def max_depth @max_depth end |
Instance Method Details
#analyzers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 54 |
# File 'lib/graphql/query/validation_pipeline.rb', line 51 def analyzers ensure_has_validated @query_analyzers end |
#internal_representation ⇒ Hash<String, nil => GraphQL::InternalRepresentation::Node] Operation name -
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Irep node pairs.
46 47 48 49 |
# File 'lib/graphql/query/validation_pipeline.rb', line 46 def internal_representation ensure_has_validated @internal_representation end |
#valid? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns does this query have errors that should prevent it from running?.
34 35 36 37 |
# File 'lib/graphql/query/validation_pipeline.rb', line 34 def valid? ensure_has_validated @valid end |
#validation_errors ⇒ Array<GraphQL::StaticValidation::Error, GraphQL::Query::VariableValidationError>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Static validation errors for the query string.
40 41 42 43 |
# File 'lib/graphql/query/validation_pipeline.rb', line 40 def validation_errors ensure_has_validated @validation_errors end |