Skip to content

Draft: Expose `squash_on_merge` field in merge request REST API

Peter Leitzen requested to merge pl-api-merge-request-squash into master

What does this MR do and why?

This MR exposes a new field squash_on_merge to Merge Request Rest API.

It also adjusts GraphQL documentation to clarify the distinction between squash and squash_on_merge fields.

Prior discussions

gitlab-ui!2875 (comment 1002258098)

Previous attempt

Previously, this MR changed existing squash field in Merge Request REST API to use logic of squash_on_merge but this would be inconsistent with GraphQL and also potentially breaks users' workflow if they relied squash current semantics.

Mismatch with GraphQL API

The GraphQL API expose two distinct fields squash and squash_on_merge. See https://gitlab.com/gitlab-org/gitlab/-/blob/7725b5e3b54a68742a5fe12eba6c00ea68a68606/app/graphql/types/merge_request_type.rb#L199-202

Note that the description of both fields are identical which is inconsistent and probably a typebug. We should fix it.

Alternatives/Controversy

Instead of changing the existing squash field in the REST API we could

This alternative might be the safer option.

MR acceptance checklist

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

Edited by Peter Leitzen

Merge request reports