Add milestone stats to GraphQL endpoint
What does this MR do?
Adds milestones statistics to the GraphQL endpoint (exposed as a stats
field).
This data is not available through the Milestones API, but is available when getting milestone data through the Releases API. Because of this, this data is necessary to make the release GraphQL data complete.
In the Releases API, this data is exposed under a issue_stats
field. This MR exposes these fields under a more generic stats
field instead, because merge request statistics will eventually be added to this type.
Testing
This MR also augments some of the existing milestone GraphQL tests to allow the new stats
field to be tested. The tests are still by no means comprehensive, but they are a little more thorough than before.
Feature flag
The new field being added as part of this MR - stats
- is hidden behind a graphql_milestone_stats
feature flag, which is enabled by default.
If this feature flag is disabled, the stats
field will still be query-able, but will always return null
.
Example query/response
Query:
{
group(fullPath: "my-example-group") {
milestones {
nodes {
title
stats {
closedIssuesCount
totalIssuesCount
}
}
}
}
}
Response:
{
"data": {
"group": {
"milestones": {
"nodes": [
{
"title": "My Example Milestone",
"stats": {
"closedIssuesCount": 1,
"totalIssuesCount": 2
}
}
]
}
}
}
}
Response when the graphql_milestone_stats
feature flag is disabled:
{
"data": {
"group": {
"milestones": {
"nodes": [
{
"title": "My Example Milestone",
"stats": null
}
]
}
}
}
}
Related to #208702 (closed)