Creating an epic link through the API with the link type "is_blocked_by" fails with a 400 error

Summary

Using the create a related epic link API endpoint, trying to Link epics with a link of type is_blocked_by results in a 400 error and the message {"error":"link_type does not have a valid value"}

This bug seems similar to: Creating an issue link through API with the link type "is_blocked_by" fails with 400

Steps to reproduce

  • Create 2 groups and create a project in each. (e.g Group ID 1 and 2 )
  • create an issue in each project
  • create an epic in each group and add the respective issues to the epic (e.g. epic_iid: 1 and target_epic_iid: 1 )
  • make the API call:
curl --request POST --header "PRIVATE-TOKEN: <access-token>" \
     --header "Content-Type: application/json" \
     --data '{
        "target_group_id": "2", 
        "target_epic_iid": "1", 
        "link_type": "is_blocked_by"
        }' \
     --url 'http://<instance-url>/api/v4/groups/1/epics/1/related_epics'

What is the current bug behavior?

Users receive a 400 error creating a related epic link with type is_blocked_by.

What is the expected correct behavior?

Link should be created succesfully

Relevant logs and/or screenshots

curl --request POST --header "PRIVATE-TOKEN: <access-token>" \
>      --header "Content-Type: application/json" \
>      --data '{
>         "target_group_id": "5", 
>         "target_epic_iid": "1", 
>         "link_type": "is_blocked_by"
>         }' \
>      --url 'http://<instance-url>/api/v4/groups/4/epics/1/related_epics'
{"error":"link_type does not have a valid value"}

Output of checks

Happens in GitLab.com and Self-managed instances.

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Christopher Mutua