Class: Taro::Types::NestedResponseType

Inherits:
ResponseType show all
Defined in:
lib/taro/types/nested_response_type.rb

Class Method Summary collapse

Methods inherited from ResponseType

#coerce_input

Methods included from Shared::Fields

#field, #fields

Methods included from Shared::ObjectCoercion

#coerce_input, #coerce_response

Methods included from Shared::CustomFieldResolvers

included, #resolve?

Class Method Details

.default_openapi_nameObject



12
13
14
15
# File 'lib/taro/types/nested_response_type.rb', line 12

def self.default_openapi_name
  field = nesting_field
  "#{field.type.openapi_name}_in_#{field.name}_Response"
end

.nesting_fieldObject



5
6
7
8
9
10
# File 'lib/taro/types/nested_response_type.rb', line 5

def self.nesting_field
  fields.size == 1 || raise(
    Taro::InvariantError, "#{self} should have 1 field, got #{fields}"
  )
  fields.each_value.first
end