diff --git a/lib/apiculture/openapi_documentation.rb b/lib/apiculture/openapi_documentation.rb index 7a6641a..b86f098 100644 --- a/lib/apiculture/openapi_documentation.rb +++ b/lib/apiculture/openapi_documentation.rb @@ -83,7 +83,7 @@ def name @path.route_parameters.each do |parameter| # This is a bit confusing but naming is a little different between # apiculture and openapi - full_path.gsub!(":#{parameter.name}", "\{#{parameter.name}\}") + full_path = full_path.gsub(":#{parameter.name}", "\{#{parameter.name}\}") end Util.clean_path("#{@prefix}#{full_path}") end diff --git a/spec/apiculture/openapi_documentation_spec.rb b/spec/apiculture/openapi_documentation_spec.rb index be362de..d740a45 100644 --- a/spec/apiculture/openapi_documentation_spec.rb +++ b/spec/apiculture/openapi_documentation_spec.rb @@ -40,6 +40,11 @@ class PancakeApi < Apiculture::App route_param :topping_id, 'Pancake topping ID', Integer, cast: :to_i api_method :get, '/pancake/with/:topping_id' do |topping_id| end + + desc 'Pancake api method definition has frozen strings'.freeze + route_param :topping_id, 'Pancake topping ID'.freeze, Integer, cast: :to_i + api_method :get, '/pancake/frozen/:topping_id'.freeze do |topping_id| + end end end @@ -80,7 +85,7 @@ class PancakeApi < Apiculture::App end it 'will have 4 paths' do - expect(paths.size).to eq(3) + expect(paths.size).to eq(4) end context 'POST /pancakes' do