Class: GraphqlGrpc::InputTypeLibrary

Inherits:
TypeLibrary show all
Defined in:
lib/graphql_grpc/type_library.rb

Constant Summary collapse

PREFIX =
'i_'.freeze

Instance Method Summary collapse

Methods inherited from TypeLibrary

#descriptor_for, descriptor_for, #initialize, ruby_class_to_dotted, ruby_class_to_underscore, #to_schema_types, #types

Constructor Details

This class inherits a constructor from GraphqlGrpc::TypeLibrary

Instance Method Details

#build_descriptors(some_types) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/graphql_grpc/type_library.rb', line 236

def build_descriptors(some_types)
  super
  # Edge case: remove any input types with empty sub_types, such
  # as is the case when a google.protobuf.Empty object is declared
  # as the argument for a gRPC call that is being mapped to a
  # GraphQL query.
  @descriptors.delete_if do |_key, descriptor|
    if descriptor.name.start_with?('google.protobuf') &&
       descriptor.respond_to?(:sub_types) &&
       descriptor.sub_types.empty?
      true
    else
      false
    end
  end
end

#type_prefixObject



232
233
234
# File 'lib/graphql_grpc/type_library.rb', line 232

def type_prefix
  PREFIX
end