Skip to content

Commit 8e45062

Browse files
committed
feat: change URL for retrieving latest version so that it does not clash with a version called "latest"
1 parent aa60a85 commit 8e45062

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

lib/pact_broker/api.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ module PactBroker
4444
add ['pacticipants', :name], Api::Resources::Pacticipant, {resource_name: "pacticipant"}
4545
add ['pacticipants', :pacticipant_name, 'versions'], Api::Resources::Versions, {resource_name: "pacticipant_versions"}
4646
add ['pacticipants', :pacticipant_name, 'versions', :pacticipant_version_number], Api::Resources::Version, {resource_name: "pacticipant_version"}
47-
add ['pacticipants', :pacticipant_name, 'versions', 'latest', :tag], Api::Resources::Version, {resource_name: "latest_tagged_pacticipant_version"}
48-
add ['pacticipants', :pacticipant_name, 'versions', 'latest'], Api::Resources::Version, {resource_name: "latest_pacticipant_version"}
47+
add ['pacticipants', :pacticipant_name, 'latest-version', :tag], Api::Resources::Version, {resource_name: "latest_tagged_pacticipant_version"}
48+
add ['pacticipants', :pacticipant_name, 'latest-version'], Api::Resources::Version, {resource_name: "latest_pacticipant_version"}
4949
add ['pacticipants', :pacticipant_name, 'versions', :pacticipant_version_number, 'tags', :tag_name], Api::Resources::Tag, {resource_name: "pacticipant_version_tag"}
5050
add ['pacticipants', :pacticipant_name, 'labels', :label_name], Api::Resources::Label, {resource_name: "pacticipant_label"}
5151

lib/pact_broker/api/resources/index.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def to_json
5454
templated: true
5555
},
5656
'pb:latest-version' => {
57-
href: base_url + '/pacticipants/{pacticipant}/versions/latest',
57+
href: base_url + '/pacticipants/{pacticipant}/latest-version',
5858
title: 'Latest pacticipant version',
5959
templated: true
6060
},
6161
'pb:latest-tagged-version' => {
62-
href: base_url + '/pacticipants/{pacticipant}/versions/latest/{tag}',
62+
href: base_url + '/pacticipants/{pacticipant}/latest-version/{tag}',
6363
title: 'Latest pacticipant version with the specified tag',
6464
templated: true
6565
},

lib/pact_broker/api/resources/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def delete_resource
3434
def version
3535
if path_info[:tag]
3636
@version ||= version_service.find_by_pacticpant_name_and_latest_tag(path_info[:pacticipant_name], path_info[:tag])
37-
elsif path_info[:number]
37+
elsif path_info[:pacticipant_version_number]
3838
@version ||= version_service.find_by_pacticipant_name_and_number path_info
3939
else
4040
@version ||= version_service.find_latest_by_pacticpant_name path_info

spec/service_consumers/hal_relation_proxy_app.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class HalRelationProxyApp
55
# the consumer does not need to know the actual URLs.
66
PATH_REPLACEMENTS = {
77
'/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-TAGGED-VERSION-Condor-production' =>
8-
'/pacticipants/Condor/versions/latest/production',
8+
'/pacticipants/Condor/latest-version/production',
99
'/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor' =>
10-
'/pacticipants/Condor/versions/latest'
10+
'/pacticipants/Condor/latest-version'
1111
}
1212

1313
RESPONSE_BODY_REPLACEMENTS = {

0 commit comments

Comments
 (0)