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
82cda94d
Commit
82cda94d
authored
Oct 10, 2019
by
Etienne Baqué
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated multiple files based on review comments
Updated api release rspec files. Updated release api documentation.
parent
6f131875
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
40 deletions
+32
-40
doc/api/releases/index.md
doc/api/releases/index.md
+12
-12
lib/api/entities.rb
lib/api/entities.rb
+4
-4
spec/fixtures/api/schemas/public_api/v4/release.json
spec/fixtures/api/schemas/public_api/v4/release.json
+3
-3
spec/fixtures/api/schemas/public_api/v4/release/release_for_guest.json
.../api/schemas/public_api/v4/release/release_for_guest.json
+3
-3
spec/requests/api/releases_spec.rb
spec/requests/api/releases_spec.rb
+10
-18
No files found.
doc/api/releases/index.md
View file @
82cda94d
...
...
@@ -123,8 +123,8 @@ Example response:
]
},
"_links"
:{
"merge_requests"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.2&scope=all&state=opened"
,
"issues"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.2&scope=all&state=opened"
"merge_requests
_url
"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.2&scope=all&state=opened"
,
"issues
_url
"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.2&scope=all&state=opened"
}
},
{
...
...
@@ -183,8 +183,8 @@ Example response:
]
},
"_links"
:{
"merge_requests"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.1&scope=all&state=opened"
,
"issues"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.1&scope=all&state=opened"
"merge_requests
_url
"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.1&scope=all&state=opened"
,
"issues
_url
"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.1&scope=all&state=opened"
}
}
]
...
...
@@ -298,8 +298,8 @@ Example response:
]
},
"_links"
:{
"merge_requests"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.1&scope=all&state=opened"
,
"issues"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.1&scope=all&state=opened"
"merge_requests
_url
"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.1&scope=all&state=opened"
,
"issues
_url
"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.1&scope=all&state=opened"
}
}
```
...
...
@@ -427,8 +427,8 @@ Example response:
]
},
"_links"
:{
"merge_requests"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.3&scope=all&state=opened"
,
"issues"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.3&scope=all&state=opened"
"merge_requests
_url
"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.3&scope=all&state=opened"
,
"issues
_url
"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.3&scope=all&state=opened"
}
}
```
...
...
@@ -532,8 +532,8 @@ Example response:
]
},
"_links"
:{
"merge_requests"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.1&scope=all&state=opened"
,
"issues"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.1&scope=all&state=opened"
"merge_requests
_url
"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.1&scope=all&state=opened"
,
"issues
_url
"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.1&scope=all&state=opened"
}
}
```
...
...
@@ -618,8 +618,8 @@ Example response:
]
},
"_links"
:{
"merge_requests"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.1&scope=all&state=opened"
,
"issues"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.1&scope=all&state=opened"
"merge_requests
_url
"
:
"https://gitlab.example.com/root/awesome_app/merge_requests?release_tag=v0.1&scope=all&state=opened"
,
"issues
_url
"
:
"https://gitlab.example.com/root/awesome_app/issues?release_tag=v0.1&scope=all&state=opened"
}
}
```
...
...
lib/api/entities.rb
View file @
82cda94d
...
...
@@ -1315,8 +1315,8 @@ module API
end
end
expose
:_links
do
expose
:merge_requests
expose
:issues
expose
:merge_requests
_url
expose
:issues
_url
end
private
...
...
@@ -1335,11 +1335,11 @@ module API
Gitlab
::
Routing
.
url_helpers
.
project_tag_path
(
project
,
object
.
tag
)
end
def
merge_requests
def
merge_requests
_url
Gitlab
::
Routing
.
url_helpers
.
project_merge_requests_url
(
project
,
params_for_issues_and_mrs
)
end
def
issues
def
issues
_url
Gitlab
::
Routing
.
url_helpers
.
project_issues_url
(
project
,
params_for_issues_and_mrs
)
end
...
...
spec/fixtures/api/schemas/public_api/v4/release.json
View file @
82cda94d
...
...
@@ -38,10 +38,10 @@
"additionalProperties"
:
false
},
"_links"
:
{
"required"
:
[
"merge_requests
"
,
"issues
"
],
"required"
:
[
"merge_requests
_url"
,
"issues_url
"
],
"properties"
:
{
"merge_requests"
:
{
"type"
:
"string"
},
"issues"
:
{
"type"
:
"string"
}
"merge_requests
_url
"
:
{
"type"
:
"string"
},
"issues
_url
"
:
{
"type"
:
"string"
}
}
}
},
...
...
spec/fixtures/api/schemas/public_api/v4/release/release_for_guest.json
View file @
82cda94d
...
...
@@ -26,10 +26,10 @@
"additionalProperties"
:
false
},
"_links"
:
{
"required"
:
[
"merge_requests
"
,
"issues
"
],
"required"
:
[
"merge_requests
_url"
,
"issues_url
"
],
"properties"
:
{
"merge_requests"
:
{
"type"
:
"string"
},
"issues"
:
{
"type"
:
"string"
}
"merge_requests
_url
"
:
{
"type"
:
"string"
},
"issues
_url
"
:
{
"type"
:
"string"
}
}
}
},
...
...
spec/requests/api/releases_spec.rb
View file @
82cda94d
...
...
@@ -64,28 +64,20 @@ describe API::Releases do
expect
(
json_response
.
second
[
'tag_path'
]).
to
eq
(
"/
#{
release_1
.
project
.
full_path
}
/-/tags/
#{
release_1
.
tag
}
"
)
end
it
'returns the merge requests and issues links'
do
get
api
(
"/projects/
#{
project
.
id
}
/releases"
,
maintainer
)
links
=
json_response
.
first
[
'_links'
]
expect
(
links
.
keys
).
to
include
(
'merge_requests'
,
'issues'
)
expect
(
links
[
'merge_requests'
]).
to
include
(
"/
#{
release_2
.
project
.
full_path
}
/merge_requests"
)
expect
(
links
[
'issues'
]).
to
include
(
"/
#{
release_2
.
project
.
full_path
}
/issues"
)
end
it
'returns urls with correct parameters and release tag'
do
it
'returns the merge requests and issues links, with correct query'
do
get
api
(
"/projects/
#{
project
.
id
}
/releases"
,
maintainer
)
links
=
json_response
.
first
[
'_links'
]
release
=
json_response
.
first
[
'tag_name'
]
expected_params
=
%w(release_tag scope state)
release_tag_param
=
"release_tag=
#{
release
}
"
expect
(
links
[
'merge_requests'
].
split
(
'?'
)[
1
]).
to
include
(
*
expected_params
)
expect
(
links
[
'issues'
].
split
(
'?'
)[
1
]).
to
include
(
*
expected_params
)
expect
(
links
[
'merge_requests'
]).
to
include
(
release_tag_param
)
expect
(
links
[
'issues'
]).
to
include
(
release_tag_param
)
expected_query
=
"release_tag=
#{
release
}
&scope=all&state=opened"
path_base
=
"/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
"
mr_uri
=
URI
.
parse
(
links
[
'merge_requests_url'
])
issue_uri
=
URI
.
parse
(
links
[
'issues_url'
])
expect
(
mr_uri
.
path
).
to
eq
(
"
#{
path_base
}
/merge_requests"
)
expect
(
issue_uri
.
path
).
to
eq
(
"
#{
path_base
}
/issues"
)
expect
(
mr_uri
.
query
).
to
eq
(
expected_query
)
expect
(
issue_uri
.
query
).
to
eq
(
expected_query
)
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