Skip to content

Allow GraphQL consumers to execute against schema where deprecations are removed

About

We could easily allow GraphQL consumers to test their queries against the future schema with deprecations removed by having the API pass a param through to the context, and checked for in #visible? methods of fields, arguments and enum values (the deprecatable schema items).

This could be a big help for consumers to test their integrations at any time, and ahead of major milestone releases.

We would document in the client-facing GraphQL docs and encourage this.

Release Post

The ?remove_deprecated=true parameter adds a new tool to GitLab's GraphQL API for analyzing the behavior of your applications and integrations leveraging deprecated fields. In the example below, when the deprecated field email is included in the request and the parameter is used within the request URI, the request will fail.

Request:

{
  project(fullPath: "hail-mary") {
    tagList
  }
}

Successful Response:

{
    "data": {
        "project": {
            "tagList": "[\"rocky\"]"
        }
    }
}

Failed Response:

{
    "errors": [
        {
            "message": "Field 'tagList' doesn't exist on type 'Project'",
            "locations": [
                {
                    "line": 3,
                    "column": 5
                }
            ],
            "path": [
                "query",
                "project",
                "tagList"
            ],
            "extensions": {
                "code": "undefinedField",
                "typeName": "Project",
                "fieldName": "tagList"
            }
        }
    ]
}
Edited by Grant Hickman