apollographql / rover

The CLI for Apollo GraphOS
https://rover.apollo.dev
Other
407 stars 85 forks source link

introspection: rover graph introspect should support flags #179

Open lrlna opened 3 years ago

lrlna commented 3 years ago

Description

Current JavaScript implementation supports several flags, which rover should support as well:

Detailed design

The bulk of the work will have to happen in rover-client's introspection query. Most of the above options need to be incorporated in introspection_query.graphql part of the options we pass to graphql_client's macro:

#[graphql(
    query_path = "src/query/graph/introspect_query.graphql", // this file will need to be modified with the applicable user passed in options before being included here
    schema_path = "src/query/graph/introspect_schema.graphql",
    response_derives = "PartialEq, Debug, Serialize, Deserialize",
    deprecated = "warn"
)]

The exact modifications can be found here.

Because graphql_client requires an existing file to be passed to query_path, we might need to create a workaround to create a file using serde with the applicable modifications, write it, and then pass it to the macro. Not yet certain on the exact solution, so we might want to set aside a bit of time to spike this before jumping into an implementation.

This issue is part of introspection work discussed in this internal scope document.

EverlastingBugstopper commented 3 years ago

we might need to create a workaround to create a file using serde with the applicable modifications, write it, and then pass it to the macro. Not yet certain on the exact solution, so we might want to set aside a bit of time to spike this before jumping into an implementation.

Unfortunately I think we'd need to write a query file with each different possible combination of flags since the query files need to be present on the filesystem at compile time - definitely the most gnarly part about adding these flags!