Module: ElasticGraph::GraphQL::MonkeyPatches::SchemaObjectVisibilityDecorator
- Defined in:
- lib/elastic_graph/graphql/monkey_patches/schema_object.rb
Overview
This module is designed to monkey patch ‘GraphQL::Schema::Object`, but to do so in a conservative, safe way:
-
It defines no new methods.
-
It delegates to the original implementation with ‘super` unless we are sure that a type should be hidden.
-
It only changes the behavior for ElasticGraph schemas (as indicated by ‘:elastic_graph_schema` in the `context`).
Instance Method Summary collapse
Instance Method Details
#visible?(context) ⇒ Boolean
21 22 23 24 25 26 27 28 |
# File 'lib/elastic_graph/graphql/monkey_patches/schema_object.rb', line 21 def visible?(context) if context[:elastic_graph_schema]&.type_named(graphql_name)&.hidden_from_queries? context[:elastic_graph_query_tracker].record_hidden_type(graphql_name) return false end super end |