diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-03-02 17:36:21 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-03-06 14:00:38 -0300 |
commit | fa0c0bb00692c77c0d01865dc17ec2b5e71bcc91 (patch) | |
tree | ad5a1eed2aba68ab70b61f074052d99e825cc556 | |
parent | b63c41e12e9e6f7e9fd1d79bedf56bd42cc17035 (diff) | |
download | gitlab-ce-fa0c0bb00692c77c0d01865dc17ec2b5e71bcc91.tar.gz |
Narrow environment payload by using basic project details resource28598-narrow-environment-payload-by-using-basic-project
-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 |