Commit 5830eeab authored by Mehmet Emin INAC's avatar Mehmet Emin INAC Committed by Markus Koller

Add top-level vulnerability field for GraphQL API

Add vulnerability field to load data for single vulnerability record.
parent 1b0e6036
...@@ -14271,6 +14271,16 @@ type Query { ...@@ -14271,6 +14271,16 @@ type Query {
""" """
startDate: ISO8601Date! startDate: ISO8601Date!
): VulnerabilitiesCountByDayAndSeverityConnection @deprecated(reason: "Use `vulnerabilitiesCountByDay`. Deprecated in 13.3") ): VulnerabilitiesCountByDayAndSeverityConnection @deprecated(reason: "Use `vulnerabilitiesCountByDay`. Deprecated in 13.3")
"""
Find a vulnerability
"""
vulnerability(
"""
The Global ID of the Vulnerability
"""
id: VulnerabilityID!
): Vulnerability
} }
""" """
......
...@@ -41743,6 +41743,33 @@ ...@@ -41743,6 +41743,33 @@
}, },
"isDeprecated": true, "isDeprecated": true,
"deprecationReason": "Use `vulnerabilitiesCountByDay`. Deprecated in 13.3" "deprecationReason": "Use `vulnerabilitiesCountByDay`. Deprecated in 13.3"
},
{
"name": "vulnerability",
"description": "Find a vulnerability",
"args": [
{
"name": "id",
"description": "The Global ID of the Vulnerability",
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "VulnerabilityID",
"ofType": null
}
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "Vulnerability",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
} }
], ],
"inputFields": null, "inputFields": null,
...@@ -21,6 +21,16 @@ module EE ...@@ -21,6 +21,16 @@ module EE
description: "Vulnerabilities reported on projects on the current user's instance security dashboard", description: "Vulnerabilities reported on projects on the current user's instance security dashboard",
resolver: ::Resolvers::VulnerabilitiesResolver resolver: ::Resolvers::VulnerabilitiesResolver
field :vulnerability,
::Types::VulnerabilityType,
null: true,
description: "Find a vulnerability",
resolve: -> (_obj, args, _ctx) { ::GitlabSchema.find_by_gid(args[:id]) } do
argument :id, ::Types::GlobalIDType[::Vulnerability],
required: true,
description: 'The Global ID of the Vulnerability'
end
field :vulnerabilities_count_by_day, field :vulnerabilities_count_by_day,
::Types::VulnerabilitiesCountByDayType.connection_type, ::Types::VulnerabilitiesCountByDayType.connection_type,
null: true, null: true,
......
---
title: Introduce top-level `vulnerability` field for GraphQL API
merge_request: 42870
author:
type: added
...@@ -8,6 +8,7 @@ RSpec.describe GitlabSchema.types['Query'] do ...@@ -8,6 +8,7 @@ RSpec.describe GitlabSchema.types['Query'] do
:iteration, :iteration,
:geo_node, :geo_node,
:vulnerabilities, :vulnerabilities,
:vulnerability,
:instance_security_dashboard, :instance_security_dashboard,
:vulnerabilities_count_by_day_and_severity :vulnerabilities_count_by_day_and_severity
).at_least ).at_least
......
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