Allow including custom attributes in API responses
What does this MR do?
This adds a with_custom_attributes
parameter to directly include custom attributes (introduced in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13038 and https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14593) in the response on queries for users/projects/groups. The following endpoints are affected:
GET /users
GET /users/:id
GET /users/:user_id/projects
GET /projects
GET /projects/:id
GET /projects/:id/forks
GET /groups
GET /groups/:id
GET /groups/:id/projects
GET /groups/:id/subgroups
Are there points in the code the reviewer needs to double check?
- The shared specs in
spec/support/shared_examples/requests/api/status_shared_examples.rb
only test the common/$COLLECTION
and/$COLLECTION/:id
endpoints, if necessary I can add more specs for the others - The API docs don't include example responses, not sure if this is necessary either (the docs already have inconsistent formats, and as I remember there are ongoing discussions about switching to auto-generated docs anyway)
Why was this MR needed?
If you want to get the custom attributes for a large number of resources, an additional request is needed per resource. As an example:
Getting the information of 1000 users, I need to do
- 10 users HTTP requests, each for a page of users with page size 100
- 1000 custom attribute requests for each single user
=> sums up to 1010 HTTP requests instead of 10
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by UX -
Has been reviewed by Frontend -
Has been reviewed by Backend -
Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together -
Internationalization required/considered
What are the relevant issue numbers?
Edited by Markus Koller