Commit e50df6b6 authored by Sean McGivern's avatar Sean McGivern

Merge branch '230380_expose_detected_at_information_on_graphql_api' into 'master'

Expose `detectedAt` information for vulnerabilities on GraphQL

See merge request gitlab-org/gitlab!41000
parents 4871220a cf914288
......@@ -17410,6 +17410,11 @@ type Vulnerability {
"""
description: String
"""
Timestamp of when the vulnerability was first detected
"""
detectedAt: Time!
"""
GraphQL ID of the vulnerability
"""
......
......@@ -51106,6 +51106,24 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "detectedAt",
"description": "Timestamp of when the vulnerability was first detected",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Time",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "id",
"description": "GraphQL ID of the vulnerability",
......@@ -2580,6 +2580,7 @@ Represents a vulnerability.
| Name | Type | Description |
| --- | ---- | ---------- |
| `description` | String | Description of the vulnerability |
| `detectedAt` | Time! | Timestamp of when the vulnerability was first detected |
| `id` | ID! | GraphQL ID of the vulnerability |
| `identifiers` | VulnerabilityIdentifier! => Array | Identifiers of the vulnerability. |
| `location` | VulnerabilityLocation | Location metadata for the vulnerability. Its fields depend on the type of security scan that found the vulnerability |
......
......@@ -66,5 +66,9 @@ module Types
description: 'The project on which the vulnerability was found',
authorize: :read_project,
resolve: -> (obj, args, context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, obj.project_id).find }
field :detected_at, Types::TimeType, null: false,
description: 'Timestamp of when the vulnerability was first detected',
method: :created_at
end
end
---
title: Introduce `detectedAt` field for VulnerabilityType on GraphQL API
merge_request: 41000
author:
type: added
......@@ -6,9 +6,24 @@ RSpec.describe GitlabSchema.types['Vulnerability'] do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:vulnerability) { create(:vulnerability, project: project) }
let(:fields) do
%i[userPermissions id title description user_notes_count state severity report_type resolved_on_default_branch vulnerability_path location scanner primary_identifier identifiers project issueLinks]
let_it_be(:fields) do
%i[userPermissions
id
title
description
user_notes_count
state
severity
report_type
resolved_on_default_branch
vulnerability_path
location
scanner
primary_identifier
identifiers
project
issueLinks
detected_at]
end
before do
......
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