Closed split closed 2 years ago
Hey @split, thanks so much for the report.
I believe that what you're encountering here is expected behavior, though likely not the most intuitive.
You'll have to opt in to Federation 2 in Apollo Studio in order for this to work. rover supergraph compose
has a bit looser version selection rules that can allow @link
directives to make the default composition function Federation 2.
However, managed federation requires an explicit opt-in. This is because we want to prevent a situation where somebody accidentally publishes a single subgraph with an @link
directive without meaning to turn on Federation 2 for the entire supergraph, possibly breaking gateways that do not support Federation 2.
You'll want to follow the docs here to explicitly opt-in to Federation 2, then this command should work as expected.
@EverlastingBugstopper Thanks for your reply and I should have mentioned I have opt-in to Federation 2 in Apollo Studio and publishing works if I use schema fetched via rover introspection
howdy @split! We've confirmed this is an issue in the underlying printSubgraphSchema
code as you mentioned and are working on fixing that in https://github.com/apollographql/federation/issues/1824.
While we work through that, would publishing your subgraph directly work for your usecase? Calling rover subgraph publish
with this subgraph should succeed:
extend schema
@link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@shareable"])
type Greeting @key(fields: "name") {
message: String! @shareable
name: String!
}
type Query {
hello(name: String!): Greeting!
}
If that's not an option, would you mind telling me more about what you're going to be doing with the subgraph schema?
Description
Federation v2 link is not detected correctly when attempting to publish
printSubgraphSchema
generated schema. Other errors rover is reporting are most likely moreprintSubgraphSchema
related.Steps to reproduce
Attempted to publish following subgraph using
rover subgraph publish
:This schema was generated using
printSubgraphSchema
(subgraph version 2.0.1) with following code:Expected result
Expected Rover to detect that schema is defined to be Federation v2
Actual result
Environment