-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query "query getService { _service { sdl } }" ignores the directive @interfaceObject #1996
Comments
@t1 I assume you are more knowledgeable in this area, would you like to look at it? If not, then I'll try to find some time, but I don't know much about the inner workings of Federation. |
I stumbled upon the same problem and discovered that a bunch of directives do not appear in the
Weirdly enough,
|
It seems that this issue is related to the following code in the final String sdl;
if (isFederation2) {
sdl = generateServiceSDLV2(newSchema.codeRegistry(newCodeRegistry.build()).build());
} else {
// For Federation1, we filter out the federation definitions
sdl = sdl(originalSchema, queryTypeShouldBeEmpty);
} Since Here are the results when executing the directive @custom on OBJECT
type Inventory @custom @interfaceObject @key(fields : "id") {
deprecatedProducts: [DeprecatedProduct!]!
id: ID!
} I've opened pull request #2003 with this fix. Hardcoding the builder to Apollo Federation 2 should be acceptable, right? Alternatively, we could introduce another configuration option to set this value. A similar problem was reported in this issue in the |
|
@RoKKim: I wasn't aware of the federation-jvm SchemaTransfomer even being executed. How do you test that? I think you are probably working on a lower level, maybe directly with the graphql-java apis? Most important, how do you add the directives to your application? The other SmallRye federation annotations like |
@t1 When executing a query, this.graphQLSchema = Federation.transform(rawSchema)
.fetchEntities(new FederationDataFetcher(rawSchema.getQueryType(), rawSchema.getCodeRegistry()))
.resolveEntityType(fetchEntityType())
.setFederation2(true)
.build(); Here is the full stack:
I have implemented a custom index initialization where I've added all missing classes during development, which is why I didn't initially notice their absence in I agree that the |
Oh, sure, now I remember. I even wrote the code that calls the Federation SchemaTransformer myself 🤪 What confused me was, that the full sdl schema string is pregenerated at this time. So I guess we need both of our PRs to be merged 😁 BTW: the Federation directives should also show up in the normal schema endpoint, shouldn't they? |
When reffering to the schema enpoint, you mean accessing |
Yes
I would assume only with your custom index initialisation, right?
I think so, too. |
I forgot about that, thanks for pointing it out. If I remove them from |
I use the graphql federation 2 directive
@interfaceObject
in a subgraph:The endpoint http://localhost:8080/graphql/schema.graphql returns a schema with the above type definition, but if I call the entdpoint http://localhost:8080/graphql with the following body, the directive
@interfaceObject
is missing in the response. Why?The text was updated successfully, but these errors were encountered: