rover icon indicating copy to clipboard operation
rover copied to clipboard

Support `rover supergraph fetch` for contract variants

Open lennyburdette opened this issue 3 years ago • 6 comments

From a customer:

When using rover supergraph fetch <variant_graph_ref> it fails saying:

error[E007]: The graph `customer@contract-variant` is a non-federated graph. This operation is only possible for federated graphs.
        Try running the command on a valid federated graph, or use the appropriate `rover graph` command instead of `rover subgraph`.

The use case is fetching the supergraph schema to use in an Uplink fallback. They need the contract supergraph with all the @inaccessible directives applied.

@jsegaran and @david-castaneda are working on an API change that should make this possible.

lennyburdette avatar Feb 17 '22 20:02 lennyburdette

I can confirm that our remote API doesn't yet support contract variants! Once that lands, this will just start working right? With no changes on Rover?

abernix avatar Feb 18 '22 10:02 abernix

@lennyburdette @abernix The API for fetching the latest approved schema should be ready for use.

This query should work for regular variants and contract variants.

query {
  service(id: "") {
    variant(name: "") {
      latestApprovedLaunch {
        build {
          result {
            ... on BuildSuccess {
              coreSchema {
                apiDocument
                coreDocument
              }
            }
          }
        }
      }
    }
  }
}

david-castaneda avatar Feb 24 '22 17:02 david-castaneda

hey @david-castaneda - would love to accept a PR that uses this new query!

EverlastingBugstopper avatar Mar 02 '22 16:03 EverlastingBugstopper

@david-castaneda will latestApprovedLaunch always be a successful launch?

lennyburdette avatar Mar 02 '22 19:03 lennyburdette

Yep. The latest approved launch contains the schema that is being used by uplink for running gateways/routers.

jsegaran avatar Mar 03 '22 04:03 jsegaran

Yep. The latest approved launch contains the schema that is being used by uplink for running gateways/routers.

jsegaran avatar Mar 03 '22 04:03 jsegaran

This works now.

EverlastingBugstopper avatar Dec 07 '22 21:12 EverlastingBugstopper