Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !7526

Merged
Created Aug 17, 2014 by Administrator@rootOwner

API: Labels validation in issues API

  • Overview 53
  • Commits 2
  • Changes 7

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
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/jubianchi/api/issue-api-validate-labels