Skip to content

Commit cb86795

Browse files
committed
fix: restore latest pact for branch endpoint
There was an overlap when introducing #728 which returns pact versions, not pact publications. This may have introduced some confusion in #858 with new HAL relations appended new routes with /versions to match existing pact_publications resource
1 parent d390227 commit cb86795

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

lib/pact_broker/api.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ def self.build_api(application_context = PactBroker::ApplicationContext.default_
3333
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "versions"], Api::Resources::PactVersions, {resource_name: "pact_publications"}
3434
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "versions", :consumer_version_number], Api::Resources::Pact, {resource_name: "pact_publication", deprecated: true} # Not the standard URL, but keep for backwards compatibility
3535
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "tag", :tag], Api::Resources::TaggedPactVersions, {resource_name: "tagged_pact_publications"}
36-
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch"], Api::Resources::PactVersionsForBranch, {resource_name: "pact_publications_for_main_branch"}
37-
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", "latest"], Api::Resources::PactVersionsForBranch, {resource_name: "latest_pact_publications_for_main_branch"}
38-
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", :branch_name, "latest"], Api::Resources::PactVersionsForBranch, {resource_name: "latest_pact_publications_for_branch"}
3936
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", :branch_name], Api::Resources::PactVersionsForBranch, {resource_name: "pact_publications_for_branch"}
37+
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", "versions"], Api::Resources::PactVersionsForBranch, {resource_name: "pact_publications_for_main_branch"}
38+
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", "latest", "versions"], Api::Resources::PactVersionsForBranch, {resource_name: "latest_pact_publications_for_main_branch"}
39+
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", :branch_name, "latest", "versions"], Api::Resources::PactVersionsForBranch, {resource_name: "latest_pact_publications_for_branch"}
4040

4141
# Pacts
4242
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "version", :consumer_version_number], Api::Resources::Pact, {resource_name: "pact_publication"}

lib/pact_broker/api/resources/index.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ def links
5757
},
5858
"pb:latest-branch-pact-versions" =>
5959
{
60-
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/{branch}/latest",
60+
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/{branch}/latest/versions",
6161
title: "Latest version of pact for a provider, for a named consumers branch",
6262
templated: true
6363
},
6464
"pb:main-branch-pact-versions" =>
6565
{
66-
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch",
66+
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/versions",
6767
title: "All versions of pacts for a provider, for a named consumers main branch",
6868
templated: true
6969
},
7070
"pb:latest-main-branch-pact-versions" =>
7171
{
72-
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/latest",
72+
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/latest/versions",
7373
title: "Latest version of pact for a provider, for a named consumers main branch",
7474
templated: true
7575
},

lib/pact_broker/doc/views/index/latest-branch-pact-versions.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Allowed methods: `GET`
44

5-
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/{branch}/latest`
5+
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/{branch}/latest/versions`
66

77
Returns the latest pact version with the specified consumer, provider and consumer version branch.

lib/pact_broker/doc/views/index/latest-main-branch-pact-versions.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Allowed methods: `GET`
44

5-
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/latest`
5+
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/latest/versions`
66

77
Lists all latest pact version with the specified consumer, provider and the consumers main branch.

lib/pact_broker/doc/views/index/main-branch-pact-versions.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Allowed methods: `GET`
44

5-
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch`
5+
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/versions`
66

77
Lists all the pact versions with the specified consumer, provider and the consumers main branch.

0 commit comments

Comments
 (0)