Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9f952833
Commit
9f952833
authored
Jan 06, 2020
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes based on review
* added schema * used declared_params * fixed minor typos
parent
e7c1b65a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
7 deletions
+36
-7
doc/api/issue_links.md
doc/api/issue_links.md
+1
-1
ee/lib/api/issue_links.rb
ee/lib/api/issue_links.rb
+1
-1
ee/spec/fixtures/api/schemas/public_api/v4/issue_link.json
ee/spec/fixtures/api/schemas/public_api/v4/issue_link.json
+20
-0
ee/spec/fixtures/api/schemas/public_api/v4/issue_links.json
ee/spec/fixtures/api/schemas/public_api/v4/issue_links.json
+9
-0
ee/spec/requests/api/issue_links_spec.rb
ee/spec/requests/api/issue_links_spec.rb
+5
-5
No files found.
doc/api/issue_links.md
View file @
9f952833
...
...
@@ -48,7 +48,7 @@ Parameters:
"web_url"
:
"http://example.com/example/example/issues/14"
,
"confidential"
:
false
,
"weight"
:
null
,
"link_type"
:
"relates_to"
,
"link_type"
:
"relates_to"
}
]
```
...
...
ee/lib/api/issue_links.rb
View file @
9f952833
...
...
@@ -39,7 +39,7 @@ module API
target_issue
=
find_project_issue
(
declared_params
[
:target_issue_iid
],
declared_params
[
:target_project_id
])
create_params
=
{
target_issuable:
target_issue
,
link_type:
params
[
:link_type
]
}
create_params
=
{
target_issuable:
target_issue
,
link_type:
declared_
params
[
:link_type
]
}
result
=
::
IssueLinks
::
CreateService
.
new
(
source_issue
,
current_user
,
create_params
)
...
...
ee/spec/fixtures/api/schemas/public_api/v4/issue_link.json
0 → 100644
View file @
9f952833
{
"type"
:
"object"
,
"properties"
:
{
"source_issue"
:
{
"allOf"
:
[
{
"$ref"
:
"../../../../../../../spec/fixtures/api/schemas/public_api/v4/issue.json"
}
]
},
"target_issue"
:
{
"allOf"
:
[
{
"$ref"
:
"../../../../../../../spec/fixtures/api/schemas/public_api/v4/issue.json"
}
]
},
"link_type"
:
{
"type"
:
"string"
,
"enum"
:
[
"relates_to"
,
"blocks"
,
"is_blocked_by"
]
}
},
"required"
:
[
"source_issue"
,
"target_issue"
,
"link_type"
]
}
ee/spec/fixtures/api/schemas/public_api/v4/issue_links.json
0 → 100644
View file @
9f952833
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"$ref"
:
"./issue_link.json"
}
}
}
ee/spec/requests/api/issue_links_spec.rb
View file @
9f952833
...
...
@@ -30,7 +30,7 @@ describe API::IssueLinks do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
).
to
include
(
'iid'
,
'title'
,
'issue_link_id'
,
'link_type
'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issue_links
'
)
end
end
end
...
...
@@ -119,14 +119,14 @@ describe API::IssueLinks do
project
.
add_reporter
(
user
)
end
it
'returns 201'
do
it
'returns 201
status and contains the expected link response
'
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/links"
,
user
),
params:
{
target_project_id:
project
.
id
,
target_issue_iid:
target_issue
.
iid
,
link_type:
'blocks'
}
expect_link_response
(
link_type:
'blocks'
)
end
context
'when `issue_link_type` is disabled'
do
context
'when `issue_link_type
s
` is disabled'
do
before
do
stub_feature_flags
(
issue_link_types:
false
)
end
...
...
@@ -148,7 +148,7 @@ describe API::IssueLinks do
def
expect_link_response
(
link_type:
'relates_to'
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
).
to
include
(
'source_issue'
,
'target_issue'
,
'link_type
'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issue_link
'
)
expect
(
json_response
[
'link_type'
]).
to
eq
(
link_type
)
end
end
...
...
@@ -212,7 +212,7 @@ describe API::IssueLinks do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/links/
#{
issue_link
.
id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
include
(
'source_issue'
,
'target_issue'
,
'link_type
'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/issue_link
'
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment