Skip to content

API: Labels validation in issues API

Created by: jubianchi

I ran into some issues while trying laboard on Gitlab 7.2.0.pre.

On Gitlab 7.1, I was able to:

  • Create label with titles like foo:bar
  • Add and remove labels from an issue

On Gitlab 7.2, I am not able to do any of those:

  • Creating labels like foo:bar returns 405 errors
  • Removing label does not work anymore

In this PR, I changed some things to get those features back:

  • I changed 405 error to 400 when labels do not validate:

405 Method Not Allowed A request was made of a resource using a request method not supported by that resource; for example, using GET on a form which requires data to be presented via POST, or using PUT on a read-only resource.

We are not dealing with HTTP methods here but with data validation.

  • I changed labels validation to get better results and expose error messages in responses
  • When editing an issue from the API, if labels is provided, we start by removing all issue's labels and then add them back, according to what is in the labels attributes of the JSON

Merge request reports