Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: do not mutate original path when generatig docs #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/apiculture/openapi_documentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion spec/apiculture/openapi_documentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down