Modify Snippet entity to support multiple files
What does this MR do?
With the arrival of multi-file snippets, we need to update the API to support returning multiple files for a snippet, when the feature flag is enabled.
This MR exposes files
(array of hashes containing path
and raw_url
for each file) if multi-file snippets FF is enabled and the snippet repository exists
Refs #217807 (closed)
As this API entity change is behind the snippet_multiple_files
feature flag, a changelog entry has not been added.
Testing
You can test this feature locally by toggling the feature flag in the Rails console with Feature.enable(:snippet_multiple_files, your_user)
and performing the following API requests (replacing < ... >
where applicable):
curl --header "PRIVATE-TOKEN: <your_access_token>" "http://127.0.0.1:3000/api/v4/snippets"
curl --header "PRIVATE-TOKEN: <your_access_token>" "http://127.0.0.1:3000/api/v4/snippets/<snippet_id>"
curl --header "PRIVATE-TOKEN: <your_access_token>" "http://127.0.0.1:3000/api/v4/projects/<project_id>/snippets"
curl --header "PRIVATE-TOKEN: <your_access_token>" "http://127.0.0.1:3000/api/v4/projects/<project_id>/snippets/<snippet_id>"
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.