Skip to content

Add code completions enabled API

What does this MR do and why?

Adds new enabled endpoint to the code completions API and a new project setting code_suggestions. enabled will return 403 Forbidden if a project has code_suggestions disabled or it's group has code_suggestions disabled in it's namespace settings.

Adds ability to read and update code_suggestions on the project to update the new project settings field

Screenshots or screen recordings

POST /api/v4/code_suggestions/enabled

  { "project_path": "group/project_name" }

Output Either 200 if enabled or 403 if not enabled.

Migration Output

How to set up and validate locally

  1. Disable code suggestions for a project (project.project_setting.update!(code_suggestions: false) in rails console)
  2. Alternately, you can disable code suggestions for a project's parent group (Group >> Settings >> General >> Permissions)
  3. Make a request to the code completion enabled API with the project's full_path
  4. Note the 403 response

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #430919 (closed)

Edited by Allen Cook

Merge request reports