Add GraphQL mutation to update a release
What does this MR do?
Adds a GraphQL mutation to update an existing release.
This is the GraphQL equivalent of the PUT /projects/:id/releases/:tag_name
API endpoint. It follows the same permission model (only Developers or higher are allowed to update releases.)
Example query/response
Query
mutation ($input: ReleaseUpdateInput!) {
releaseUpdate(input: $input) {
release {
name
tagName
description
releasedAt
milestones {
nodes {
title
}
}
}
errors
}
}
Variables:
{
"input": {
"projectPath": "root/release-test",
"tagName": "v5.34",
"name": "Updated name",
"description": "Updated description",
"releasedAt": "2018-12-10",
"milestones": ["12.3", "12.4"]
}
}
Response:
{
"data": {
"releaseUpdate": {
"release": {
"name": "Updated name",
"tagName": "v5.34",
"description": "Updated description",
"releasedAt": "2018-12-10T05:00:00Z",
"milestones": {
"nodes": [
{
"title": "12.4"
},
{
"title": "12.3"
}
]
}
},
"errors": []
}
}
}
When the user doesn't have permission
Response:
{
"data": {
"releaseUpdate": null
},
"errors": [
{
"message": "The resource that you are attempting to access does not exist or you don't have permission to perform this action",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"releaseUpdate"
]
}
]
}
top-level error
An example of a response with a{
"data": {
"releaseUpdate": null
},
"errors": [
{
"message": "if the releasedAt argument is provided, it cannot be null",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"releaseUpdate"
]
}
]
}
error-as-data
An example of a response with an{
"data": {
"releaseUpdate": {
"release": null,
"errors": [
"Tag does not exist"
]
}
}
}
Edited by Nathan Friend