apollographql / federation-jvm

JVM support for Apollo Federation
https://www.apollographql.com/docs/federation/
MIT License
250 stars 65 forks source link

generateServiceSDL in ServiceSDLPrinter - invalid includeDirectives configfuration? #361

Closed Przemeo closed 9 months ago

Przemeo commented 11 months ago

Hello, I am using Federation.transform(GraphQLSchema schema) method (which creates SchemaTransformer) and finally building the schema using SchemaTransformer.build() method - I have noticed that the sdl it generates does not include my own directives when isFederation2 is set to false. I think the problem occurs because generateServiceSDL method in ServiceSDLPrinter sets includeDirectives as FederationDirectives.allNames::contains - shouldn't the negated predicate be used here?

dariuszkuc commented 11 months ago

Hello 👋 SDL generated for Federation v1 schemas is not a full schema but rather a schema that should be used for composition (and returned as part of the _service { sdl } query). Federation v2 relaxed composition rules to accept full SDL schemas.

I'd highly recommend to migrate to Federation v2 ASAP.