Skip to content

Modify Snippet entity to support multiple files

Vijay Hawoldar requested to merge vij-snippet-blob-entity into master

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

Availability and Testing

Edited by 🤖 GitLab Bot 🤖

Merge request reports