Commit 55c4e6a1 authored by Jonathan Schafer's avatar Jonathan Schafer

Return finding_uuid with vulnerability_feedback

The finding_uuid field will be returned in the response of the
vulnerability_feedback endpoint
parent 8097e234
...@@ -12,6 +12,7 @@ class Vulnerabilities::FeedbackEntity < Grape::Entity ...@@ -12,6 +12,7 @@ class Vulnerabilities::FeedbackEntity < Grape::Entity
expose :comment_timestamp expose :comment_timestamp
expose :comment_author, using: UserEntity expose :comment_author, using: UserEntity
end end
expose :finding_uuid
expose :pipeline, if: -> (feedback, _) { feedback.pipeline.present? } do expose :pipeline, if: -> (feedback, _) { feedback.pipeline.present? } do
expose :id do |feedback| expose :id do |feedback|
......
---
title: Return the finding_uuid attribute in the response of vulnerability_feedback
endpoint
merge_request: 49745
author:
type: changed
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
}, },
"project_fingerprint": { "type": "string" }, "project_fingerprint": { "type": "string" },
"branch": { "type": ["string", "null"] }, "branch": { "type": ["string", "null"] },
"destroy_vulnerability_feedback_dismissal_path": { "type": "string" } "destroy_vulnerability_feedback_dismissal_path": { "type": "string" },
"finding_uuid": { "type": ["string", "null"] }
}, },
"additionalProperties": false "additionalProperties": false
} }
...@@ -167,4 +167,21 @@ RSpec.describe Vulnerabilities::FeedbackEntity do ...@@ -167,4 +167,21 @@ RSpec.describe Vulnerabilities::FeedbackEntity do
expect(subject[:comment_details]).to include(:comment_author) expect(subject[:comment_details]).to include(:comment_author)
end end
end end
context 'when finding_uuid is not present' do
let(:feedback) { build(:vulnerability_feedback, :issue, project: project) }
it 'has a nil finding_uuid' do
expect(subject[:finding_uuid]).to be_nil
end
end
context 'when finding_uuid is present' do
let_it_be(:finding) { create(:vulnerabilities_finding) }
let(:feedback) { create(:vulnerability_feedback, finding_uuid: finding.uuid, project: project) }
it 'exposes finding_uuid' do
expect(subject[:finding_uuid]).to eq(finding.uuid)
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment