diff --git a/lib/api/v3/custom_fields/hierarchy/hierarchy_item_representer.rb b/lib/api/v3/custom_fields/hierarchy/hierarchy_item_representer.rb index c978dd7993c4..fc527c011e99 100644 --- a/lib/api/v3/custom_fields/hierarchy/hierarchy_item_representer.rb +++ b/lib/api/v3/custom_fields/hierarchy/hierarchy_item_representer.rb @@ -36,7 +36,13 @@ def _type end self_link path: :custom_field_item, - title_getter: ->(*) { represented.label } + title_getter: ->(*) do + if represented.short.nil? + represented.label + else + "#{represented.label} (#{represented.short})" + end + end property :id diff --git a/spec/lib/api/v3/custom_fields/hierarchy/hierarchy_item_representer_rendering_spec.rb b/spec/lib/api/v3/custom_fields/hierarchy/hierarchy_item_representer_rendering_spec.rb index 933145199a6b..4a33d86b16e8 100644 --- a/spec/lib/api/v3/custom_fields/hierarchy/hierarchy_item_representer_rendering_spec.rb +++ b/spec/lib/api/v3/custom_fields/hierarchy/hierarchy_item_representer_rendering_spec.rb @@ -121,7 +121,7 @@ it_behaves_like "has a titled link" do let(:link) { "self" } let(:href) { api_v3_paths.custom_field_item(item.id) } - let(:title) { item.label } + let(:title) { "#{item.label} (#{item.short})" } end it_behaves_like "has a titled link" do @@ -171,7 +171,7 @@ it_behaves_like "has a titled link" do let(:link) { "self" } let(:href) { api_v3_paths.custom_field_item(item.id) } - let(:title) { item.label } + let(:title) { "#{item.label} (#{item.short})" } end it_behaves_like "has a titled link" do