Deprecate query parameters in schema?


Hi there,

I haven’t found any resources on this, but is it possible (under Graphql specs and with Apollo specifically) to add deprecation notices to query parameters?

We’re restructuring some of our API and want to group some common parameters we use in several queries into one input type, e.g.:

  type Query {
    things(id: ID, thingIds: [ID], filter: ThingFilter): [Thing]

Here, thingIds is the old parameter I would like to deprecate, as it is replaced by the new filter parameter of type ThingFilter.

I would rather not add a second things query variation.

So I’ve just tried adding the @deprecated clause after the parameters and I get no syntax errors, so I am guessing it should work.
But the deprecation doesn’t show up in the docs or anywhere else.

  type Query {
      id: ID @deprecated(reason: "use the filter object instead"),
      thinIds: [ID] @deprecated(reason: "use the filter object instead"),
      filter: ThingFilter)
      : [Thing]

Now, I am using the merge-graphql-schemas package to split my schema pieces up, so I guess it’s conceivable that these directives are ignored during the merge and don’t reach the final schema (I’ll have to check). But I’d just like to know what the official way of doing this would be. :confused: