Skip to content

Add a new project-specific templates API endpoint

Nick Thomas requested to merge (removed):ce-5987-project-templates-api into master

What does this MR do?

This MR is an essential prerequisite to the "Group level file templates" 11.4 deliverable: #5987 (closed) -> !7391 (merged)

Central to this feature is the fact that the available templates may change based on the group the applying project is in.

The current API endpoints do not even know which project we're pulling templates from, so cannot be used to implement this functionality. Modifying them to respect a project parameter is difficult, so this MR introduces new API endpoints to be used instead:

  • GET /api/v4/projects/:id/templates/:type
  • GET /api/v4/projects/:id/templates/:type/:name

They return basically the same information as the non-project-specific endpoints, but since they know what the project is, that information can be used to look up templates from additional sources.

This MR also modifies the blob editor and web IDE to use these new project-specific endpoints when looking up and applying templates.

What are the relevant issue numbers?

Related to https://gitlab.com/gitlab-org/gitlab-ee/issues/5987

Does this MR meet the acceptance criteria?

Merge request reports

Loading