Add new Event serializer to return JSON only response based on FF
requested to merge 378695-update-users-controller-to-return-json-html-response-based-on-feature-flag into master
What does this MR do and why?
Creates a new serializer to return JSON response of Events based on the feature flag introduced in issue 37868
How to set up and validate locally
- Make an API request using Postman/CURL requesting JSON format: http://127.0.0.1:3000/users/root/activity?limit=5&format=json
- Expect a response similar to the following:
Sample response
[
{
"created_at": "2023-02-22T11:56:20.502Z",
"action": "pushed",
"ref": {
"type": "branch",
"count": null,
"name": "new_branch",
"path": "/le/ab/-/commits/new_branch"
},
"commit": {
"truncated_sha": "ada0fe81",
"path": "/le/ab/-/commit/ada0fe81494fb8fa59af54360cc6ba49c71446b9",
"title": "Added a file",
"count": 1,
"create_mr_path": "/le/ab/-/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch",
"from_truncated_sha": null,
"to_truncated_sha": "ada0fe81"
},
"author": {
"id": 11,
"name": "Gwyn Pollich",
"path": "le"
},
"target": {
"target_type": null,
"title": null
},
"resource_parent": {
"type": "project",
"full_name": "Gwyn Pollich / __1",
"full_path": "le/ab"
}
},
{
"created_at": "2023-02-22T11:56:20.501Z",
"action": "pushed",
"ref": {
"type": "branch",
"count": null,
"name": "new_branch",
"path": "/le/ab/-/commits/new_branch"
},
"commit": {
"truncated_sha": "5b8ca6ce",
"path": "/le/ab/-/commit/5b8ca6ce788c7140403ab78cba4ffff9166223b5",
"title": "Added text",
"count": 1,
"create_mr_path": null,
"from_truncated_sha": "ada0fe81",
"to_truncated_sha": "5b8ca6ce"
},
"author": {
"id": 11,
"name": "Gwyn Pollich",
"path": "le"
},
"target": {
"target_type": null,
"title": null
},
"resource_parent": {
"type": "project",
"full_name": "Gwyn Pollich / __1",
"full_path": "le/ab"
}
},
{
"created_at": "2023-02-20T12:56:32.949Z",
"action": "commented",
"author": {
"id": 11,
"name": "Gwyn Pollich",
"path": "le"
},
"target": {
"target_type": "Note",
"title": "1",
"target_url": "/le/abc/-/issues/1#note_1399",
"first_line_in_markdown": "<p>Hi</p>",
"attachment": {
"url": null
}
},
"resource_parent": {
"type": "project",
"full_name": "Gwyn Pollich / .abc",
"full_path": "le/abc"
}
},
{
"created_at": "2023-02-20T12:10:33.216Z",
"action": "created",
"author": {
"id": 11,
"name": "Gwyn Pollich",
"path": "le"
},
"target": {
"target_type": "Issue",
"title": "1",
"target_url": "/le/abc/-/issues/1",
"reference_link_text": "#1"
},
"resource_parent": {
"type": "project",
"full_name": "Gwyn Pollich / .abc",
"full_path": "le/abc"
}
},
{
"created_at": "2023-02-17T02:50:26.040Z",
"action": "pushed",
"ref": {
"type": "branch",
"count": null,
"name": "main",
"path": "/le/ab/-/commits/main"
},
"commit": {
"truncated_sha": "f7cddfd1",
"path": "/le/ab/-/commit/f7cddfd1c31f17879f15fd7c799a7e34fc5b97d3",
"title": "Add new file",
"count": 1,
"create_mr_path": null,
"from_truncated_sha": "21082f19",
"to_truncated_sha": "f7cddfd1"
},
"author": {
"id": 11,
"name": "Gwyn Pollich",
"path": "le"
},
"target": {
"target_type": null,
"title": null
},
"resource_parent": {
"type": "project",
"full_name": "Gwyn Pollich / __1",
"full_path": "le/ab"
}
}
]
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #378695 (closed)
Edited by Abdul Wadood