Skip to content

Commit eda8cbf

Browse files
committed
feat: deprecate provider relation in provider pacts resource in preference for pb:provider
1 parent 14131c5 commit eda8cbf

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

lib/pact_broker/api/decorators/provider_pacts_decorator.rb

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class ProviderPactsDecorator < BaseDecorator
1414
}
1515
end
1616

17-
link :provider do | context |
17+
link :'pb:provider' do | context |
1818
{
1919
href: pacticipant_url(context[:base_url], OpenStruct.new(name: context[:provider_name])),
20-
title: context[:provider_name]
20+
name: context[:provider_name]
2121
}
2222
end
2323

@@ -32,6 +32,14 @@ class ProviderPactsDecorator < BaseDecorator
3232
end
3333
end
3434

35+
link :provider do | context |
36+
{
37+
href: pacticipant_url(context[:base_url], OpenStruct.new(name: context[:provider_name])),
38+
title: context[:provider_name],
39+
name: "DEPRECATED - please use the pb:provider relation"
40+
}
41+
end
42+
3543
links :'pacts' do | context |
3644
represented.collect do | pact |
3745
{

spec/lib/pact_broker/api/decorators/provider_pacts_decorator_spec.rb

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ module Decorators
1313
{
1414
base_url: 'http://example.org',
1515
resource_url: 'http://example.org/provider-pacts',
16-
title: 'title'
16+
title: 'title',
17+
provider_name: 'foo'
1718
}
1819
end
1920

@@ -30,9 +31,9 @@ module Decorators
3031
:href=> "http://example.org/provider-pacts",
3132
:title => "title"
3233
},
33-
:provider => {
34-
:href => "http://example.org/pacticipants/",
35-
:title => nil
34+
:"pb:provider" => {
35+
:href => "http://example.org/pacticipants/foo",
36+
:name => "foo"
3637
},
3738
:"pb:pacts" =>[{
3839
:href => "pact_url",

0 commit comments

Comments
 (0)