Skip to content

Add specs for updating issuable labels in API

Stan Hu requested to merge sh-add-issuable-nil-specs into master

This is in preparation for upgrading to Grape v1.3.x. Parameters of Array types will no longer automatically coerced to empty arrays if a key is provided with a nil value.

Full details: Grape v1.3.3 (https://github.com/ruby-grape/grape/pull/2040#issuecomment-615483919) changes how nil values are handled with Array types:

  1. Array types no longer are automatically coerced to [] if a key is given without a value. The value remains as nil.
  2. For example, in the PUT /:id/issues/:issue_iid case, specifying labels= as a query parameter means "clear all labels". In Grape v1.1.1, this would be equivalent to:
params[:labels] = []

Whereas in Grape v1.3.3, this would now be:

params[:labels] = nil

The first example would clear all labels, while the second one would leave them alone.

Part of #195960 (closed)

Edited by Stan Hu

Merge request reports