Skip to content

Allow empty search string for iterations search

euko requested to merge 336611-allow-empty-search-string into master

What does this MR do and why?

The GraphQL API for searching iterations by title and cadence title should accept an empty search string.

Note that the ability to search iterations by title and cadence title via GraphQL was just added in !76231 (merged) this milestone.

Here's a sample query:

query{
  project(fullPath: "gitlab-org/gitlab") {
    iterations(search: "", in: [TITLE, CADENCE_TITLE]) {
      nodes {
        id
        title
      }
    }
  }
}

The current query behavior:

When search argument is an empty string, the API currently rejects the request.

https://gitlab.com/-/graphql-explorer

{
  "data": {
    "project": {
      "iterations": null
    }
  },
  "errors": [
    {
      "message": "'search' must be specified when using 'in' argument.",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "project",
        "iterations"
      ]
    }
  ]
}

The desired query behavior:

The API returns all iterations (or the first N iterations).

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 #336611 (closed)

Edited by euko

Merge request reports

Loading