Skip to content

Allow projects to be queried by ids with GraphQL

Max Orefice requested to merge mo-graphql-query-projects-by-ids into master

Ref: #231386 (closed)

What does this MR do?

This MR makes it possible to query projects by ids with our GraphQL API.

Why are we doing this?

We are working to expose our CodeCoverage data to our GraphQL API.

As pointed out by @shampton, in order to do so we need to query projects by ids so we can fetch the CodeCoverage for those given projects.

You can check how the feature will look like by visiting those 2 links:

Screenshots

GraphQL request Response Documentation
{ 
  projects(ids: ["gid://gitlab/Project/22", "gid://gitlab/Project/21"]) {
    nodes {
      name
      id
    }
  }
}
{
  "data": {
    "projects": {
      "nodes": [
        {
          "name": "test-codequality",
          "id": "gid://gitlab/Project/22"
        },
        {
          "name": "test",
          "id": "gid://gitlab/Project/21"
        }
      ]
    }
  }
}
GraphiQL_2020-09-15_11-08-40

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Max Orefice

Merge request reports