diff --git a/lib/apipie/generator/swagger/param_description/type.rb b/lib/apipie/generator/swagger/param_description/type.rb index f35c49b7..50443b72 100644 --- a/lib/apipie/generator/swagger/param_description/type.rb +++ b/lib/apipie/generator/swagger/param_description/type.rb @@ -114,7 +114,7 @@ def validator def warn_hash_without_internal_typespec method_id = if @param_description.is_a?(Apipie::ResponseDescriptionAdapter::PropDesc) - @controller_method.method + @controller_method.method_name else Apipie::Generator::Swagger::MethodDescription::Decorator.new(@param_description.method_description).ruby_name end diff --git a/spec/lib/apipie/generator/swagger/param_description/type_spec.rb b/spec/lib/apipie/generator/swagger/param_description/type_spec.rb index dbbe34f0..93999b4d 100644 --- a/spec/lib/apipie/generator/swagger/param_description/type_spec.rb +++ b/spec/lib/apipie/generator/swagger/param_description/type_spec.rb @@ -63,9 +63,11 @@ ) end + let(:controller_method) { 'index' } + let(:type_definition) do described_class. - new(param_description, with_null: with_null, controller_method: 'index'). + new(param_description, with_null: with_null, controller_method: controller_method). to_hash end @@ -178,6 +180,22 @@ it 'outputs a hash without internal typespec warning' do expect { subject }.to output(/is a generic Hash without an internal type specification/).to_stderr end + + context 'and param is a prop desc with a delegated controller method' do + let(:param_description) do + Apipie.prop(param_description_name, 'object', {}, []) + end + + let(:controller_method) do + Apipie::Generator::Swagger::MethodDescription::Decorator.new( + method_desc + ) + end + + it 'outputs a hash without internal typespec warning' do + expect { subject }.to output(/is a generic Hash without an internal type specification/).to_stderr + end + end end end end