Commit 834c413b authored by Markus Koller's avatar Markus Koller

Merge branch '223813_implement_vulnerability_graphql_query' into 'master'

Add top-level vulnerability field for GraphQL API

See merge request gitlab-org/gitlab!42870
parents 51eebe52 5830eeab
...@@ -14301,6 +14301,16 @@ type Query { ...@@ -14301,6 +14301,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
} }
""" """
......
...@@ -41796,6 +41796,33 @@ ...@@ -41796,6 +41796,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