Loading
Declare work_item_type_ids as first-class REST API filter param
What does this MR do and why?
Formally declares the work_item_type_ids filter on the Work Items REST list endpoint (project + group). Previously the param was undeclared but worked because the raw params hash was passed through to the finder. This formalizes it with proper typing, coercion, and validation.
Changes:
- Declares
work_item_type_idsas an optionalArray[Integer]param in the top-level filter block, withCommaSeparatedToIntegerArraycoercion - Declares
work_item_type_idsin thenotblock for negated filtering - Adds
mutually_exclusive :types, :work_item_type_idsin both blocks to guard against the silent-AND footgun whiletypesstill exists - No transformer change needed: the key already matches the finder key (
work_item_type_idsflows directly toWorkItemsFinder→IssueTypesFilter#by_work_item_type_ids→with_work_item_type_idsscope) - Adds filter tests covering positive filter, array OR, negation, and mutual exclusivity with
types - Removes
work_item_type_idsfrom parity specknown_exceptionsnow that the param is declared
This is step 1 of 2; step 2 will remove the types filter separately (parent: #605888 (closed)).
Closes #605896 (closed)
References
- Work item: #605896 (closed)
- Parent issue: #605888 (closed)
Screenshots or screen recordings
N/A — API-only change, no UI changes.
How to set up and validate locally
- Start the Rails server
- Create a work item of type Task (type ID 5) in a project
- Call
GET /api/v4/projects/:id/-/work_items?work_item_type_ids[]=5— returns only Task work items - Call
GET /api/v4/projects/:id/-/work_items?work_item_type_ids[]=5&work_item_type_ids[]=1— returns Tasks and Issues - Call
GET /api/v4/projects/:id/-/work_items?not[work_item_type_ids][]=5— excludes Tasks - Call
GET /api/v4/projects/:id/-/work_items?types=task&work_item_type_ids[]=5— returns 400 with mutually exclusive error
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.