Class: Taro::Types::NestedResponseType

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

Constant Summary

Constants included from Shared::OpenAPIFormat

Shared::OpenAPIFormat::OPENAPI_INTEGER_FORMATS, Shared::OpenAPIFormat::OPENAPI_NUMBER_FORMATS, Shared::OpenAPIFormat::OPENAPI_STRING_FORMATS

Constants included from Shared::OpenAPIType

Shared::OpenAPIType::OPENAPI_TYPES

Instance Attribute Summary

Attributes inherited from BaseType

#object

Attributes included from Shared::AdditionalProperties

#additional_properties

Attributes included from Shared::Deprecation

#deprecated

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?

Methods included from Shared::AdditionalProperties

#additional_properties?, #inherited

Methods included from Shared::DerivedTypes

#define_derived_type, #derived_types, map

Methods included from Shared::Description

#desc, #desc=

Methods included from Shared::Equivalence

#equal_properties?, #equivalent?

Methods included from Shared::Name

#define_name

Methods included from Shared::OpenAPIFormat

#inherited, #openapi_format, #openapi_format=

Methods included from Shared::OpenAPIName

#default_openapi_name, #openapi_name, #openapi_name=

Methods included from Shared::OpenAPIType

#inherited, #openapi_type, #openapi_type=

Methods included from Shared::Rendering

#last_render, #last_render=, #render, #used_in_response

Methods included from Shared::TypeClass

included

Methods included from Shared::Errors

#coerce_error_message, #input_error, #response_error

Methods included from Shared::Caching

#cached_coerce_response, included

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