Module: Taro::Types::Shared::OpenAPIName
- Defined in:
- lib/taro/types/shared/openapi_name.rb
Overview
Provides a setter, getter and defaults for type classes’ ‘openapi_name`, for use in the OpenAPI export ($refs and corresponding component names).
Instance Method Summary collapse
Instance Method Details
#default_openapi_name ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/taro/types/shared/openapi_name.rb', line 14 def default_openapi_name if self < Taro::Types::EnumType || self < Taro::Types::InputType || self < Taro::Types::ObjectType name && name.chomp('Type').gsub('::', '_') || raise(Taro::Error, 'openapi_name must be set for anonymous type classes') elsif self < Taro::Types::ScalarType openapi_type else raise Taro::Error, 'no default_openapi_name implemented for this type' end end |
#openapi_name ⇒ Object
4 5 6 |
# File 'lib/taro/types/shared/openapi_name.rb', line 4 def openapi_name @openapi_name ||= default_openapi_name end |
#openapi_name=(arg) ⇒ Object
8 9 10 11 12 |
# File 'lib/taro/types/shared/openapi_name.rb', line 8 def openapi_name=(arg) arg.nil? || arg.is_a?(String) || raise(Taro::ArgumentError, 'openapi_name must be a String') @openapi_name = arg end |