diff options
author | Rémy Coutable <remy@rymai.me> | 2017-03-07 00:40:35 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-03-07 00:40:35 +0000 |
commit | e1cc0fd564fd03a4ff3b01b0124420f8a02c1970 (patch) | |
tree | c841a74837f7b3540b30df65992d0fde0b80b253 | |
parent | ef24c9ef775218adfdb8178fdc9a3bf4016a53b0 (diff) | |
parent | fa0c0bb00692c77c0d01865dc17ec2b5e71bcc91 (diff) | |
download | gitlab-ce-e1cc0fd564fd03a4ff3b01b0124420f8a02c1970.tar.gz |
Merge branch '28598-narrow-environment-payload-by-using-basic-project' into 'master'
Simplify project payload exposed on Environment endpoints in V4
Closes #28598
See merge request !9675
-rw-r--r-- | changelogs/unreleased/28598-narrow-environment-payload-by-using-basic-project.yml | 4 | ||||
-rw-r--r-- | doc/api/v3_to_v4.md | 2 | ||||
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/environments_spec.rb | 5 |
4 files changed, 10 insertions, 3 deletions
diff --git a/changelogs/unreleased/28598-narrow-environment-payload-by-using-basic-project.yml b/changelogs/unreleased/28598-narrow-environment-payload-by-using-basic-project.yml new file mode 100644 index 00000000000..ada726c9048 --- /dev/null +++ b/changelogs/unreleased/28598-narrow-environment-payload-by-using-basic-project.yml @@ -0,0 +1,4 @@ +--- +title: Narrow environment payload by using basic project details resource +merge_request: +author: diff --git a/doc/api/v3_to_v4.md b/doc/api/v3_to_v4.md index e5ef64fa8dc..5af775860ca 100644 --- a/doc/api/v3_to_v4.md +++ b/doc/api/v3_to_v4.md @@ -68,3 +68,5 @@ changes are in V4: - Rename Build Triggers to be Pipeline Triggers API [!9713](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9713) - `POST /projects/:id/trigger/builds` to `POST /projects/:id/trigger/pipeline` - Require description when creating a new trigger `POST /projects/:id/triggers` +- Simplify project payload exposed on Environment endpoints [!9675](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9675) + diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 965f8fbab8f..2230aa0706b 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -671,7 +671,7 @@ module API end class Environment < EnvironmentBasic - expose :project, using: Entities::Project + expose :project, using: Entities::BasicProjectDetails end class Deployment < Grape::Entity diff --git a/spec/requests/api/environments_spec.rb b/spec/requests/api/environments_spec.rb index f2fd1dfc8db..b54ee8e8b85 100644 --- a/spec/requests/api/environments_spec.rb +++ b/spec/requests/api/environments_spec.rb @@ -15,6 +15,8 @@ describe API::Environments, api: true do describe 'GET /projects/:id/environments' do context 'as member of the project' do it 'returns project environments' do + project_data_keys = %w(id http_url_to_repo web_url name name_with_namespace path path_with_namespace) + get api("/projects/#{project.id}/environments", user) expect(response).to have_http_status(200) @@ -23,8 +25,7 @@ describe API::Environments, api: true do expect(json_response.size).to eq(1) expect(json_response.first['name']).to eq(environment.name) expect(json_response.first['external_url']).to eq(environment.external_url) - expect(json_response.first['project']['id']).to eq(project.id) - expect(json_response.first['project']['visibility']).to be_present + expect(json_response.first['project'].keys).to contain_exactly(*project_data_keys) end end |