Commit 9218c22a authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Merge branch 'return_slug_in_api_services_index' into 'master'

Return slug in /api/v4/projects/ID/services

Closes #195795

See merge request gitlab-org/gitlab!22664
parents d83fd708 4cb6a9bb
---
title: Add slug to services API response
merge_request: 22518
author:
type: added
......@@ -19,6 +19,7 @@ Example response:
{
"id": 75,
"title": "Jenkins CI",
"slug": "jenkins",
"created_at": "2019-11-20T11:20:25.297Z",
"updated_at": "2019-11-20T12:24:37.498Z",
"active": true,
......@@ -38,6 +39,7 @@ Example response:
{
"id": 76,
"title": "Alerts endpoint",
"slug": "alerts",
"created_at": "2019-11-20T11:20:25.297Z",
"updated_at": "2019-11-20T12:24:37.498Z",
"active": true,
......@@ -753,6 +755,7 @@ Example response:
{
"id": 4,
"title": "Slack slash commands",
"slug": "slack-slash-commands",
"created_at": "2017-06-27T05:51:39-07:00",
"updated_at": "2017-06-27T05:51:39-07:00",
"active": true,
......
......@@ -1129,7 +1129,11 @@ module API
end
class ProjectServiceBasic < Grape::Entity
expose :id, :title, :created_at, :updated_at, :active
expose :id, :title
expose :slug do |service|
service.to_param.dasherize
end
expose :created_at, :updated_at, :active
expose :commit_events, :push_events, :issues_events, :confidential_issues_events
expose :merge_requests_events, :tag_push_events, :note_events
expose :confidential_note_events, :pipeline_events, :wiki_page_events
......
......@@ -3,6 +3,7 @@
"properties": {
"id": { "type": "integer" },
"title": { "type": "string" },
"slug": { "type": "string" },
"created_at": { "type": "date-time" },
"updated_at": { "type": "date-time" },
"active": { "type": "boolean" },
......
......@@ -35,6 +35,7 @@ describe API::Services do
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_an Array
expect(json_response.count).to eq(1)
expect(json_response.first['slug']).to eq('emails-on-push')
expect(response).to match_response_schema('public_api/v4/services')
end
end
......@@ -61,6 +62,7 @@ describe API::Services do
put api("/projects/#{project.id}/services/#{dashed_service}?#{query_strings}", user), params: service_attrs
expect(response).to have_gitlab_http_status(200)
expect(json_response['slug']).to eq(dashed_service)
events.each do |event|
next if event == "foo"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment