rover
rover copied to clipboard
Add support for @deprecated on input fields
It's officially part of the spec so rover should support it as well. Others have gone through similar additions for @deprecated support https://github.com/apollographql/router/pull/1452
We can now see @deprecated on the ProductQueryInput input below:
➜ cargo rover graph introspect http://localhost:4000
Finished dev [unoptimized + debuginfo] target(s) in 0.24s
Running `target/debug/rover graph introspect 'http://localhost:4000'`
Introspection Response:
type Product {
upc: String!
name: String @deprecated(reason: "We no longer care about the product name")
price: Int
}
type Query {
product(productQuery: ProductQueryInput): Product
}
input ProductQueryInput {
upc: String
name: String @deprecated(reason: "We really no longer care about the product name")
price: Int
}
"Exposes a URL that specifies the behavior of this scalar."
directive @specifiedBy(
"The URL that specifies the behavior of this scalar."
url: String!
) on SCALAR
Fixes #1209
Agreed there'd be an issue introspecting something that doesn't support includeDeprecated for inputs. Using 2-phase introspection makes sense.
I got my hands on one of these servers that don't support includeDeprecated on __Input, so I'll make sure rover still supports that.
Even though I got my hands on a subgraph server to replicate the issue, I don't quite know how to make it work. Part of it is making a decent design, the other is making it work with my feeble rust skills.
- Is there a way around making 2 requests to get all the info we want? At least for the server I'm testing with, there's not a way to make a single request to optionally get input field deprecation info (it fails with a parse error if I try to include the
includeDeprecatedparam) - If 2 requests seems like the only path, do we make the original request and then request with only the
inputFields(includeDeprecated: true)fields and theisDeprecated&deprecationReasonselection, then add it to the original query data?
that sounds like a reasonable approach to me!
as for how to combine that - you'll want a struct with the includeDeprecated as an Option - and on the second request, set that field to Some if it exists and leave it None if it doesnt
I wonder if @IvanGoncharov has any thoughts here.
This may not be helpful at all but would the @include(if: $someFlag) decorator be useful to restrict when asking for the input field deprecations?
Would it be worth adding support for includeDeprecated on args in this PR too? The referenced PR (https://github.com/apollographql/router/pull/1452) also includes args, so it'd be nice to get that in too <3
If anyone else would be interested in picking this up and move it across the line, please feel free!
@abernix Any movement on this? I'd love to see Rover adopt this addition to the spec so teams can more confidently ship changes to their mutations that (at my org) rely heavily on Input objects
This PR needs to be landed in introspector-gadget instead, follow this issue for updates.