Apollo federation won't start if I try to use directives like so:
directive @entity(
embedded: Boolean
additionalFields: [AdditionalEntityFields]
) on OBJECT
input AdditionalEntityFields {
path: String
type: String
}
Error: Schema must contain uniquely named types but contains multiple types named "AdditionalEntityFields".
This is a valid schema.
It should accept a correct schema with non-scalar directive arguments.
/sandbox/node_modules/graphql/type/schema.js:262
throw new Error("Schema must contain uniquely named types but contains multiple types named \"".concat(namedType.name, "\"."));
^
Error: Schema must contain uniquely named types but contains multiple types named "AdditionalEntityFields".
at typeMapReducer (/sandbox/node_modules/graphql/type/schema.js:262:13)
at /sandbox/node_modules/graphql/type/schema.js:307:12
at Array.reduce (<anonymous>)
at typeMapDirectiveReducer (/sandbox/node_modules/graphql/type/schema.js:306:25)
at Array.reduce (<anonymous>)
at new GraphQLSchema (/sandbox/node_modules/graphql/type/schema.js:147:32)
at Object.transformSchema (/sandbox/node_modules/apollo-graphql/lib/schema/transformSchema.js:17:12)
at buildFederatedSchema (/sandbox/node_modules/@apollo/federation/dist/service/buildFederatedSchema.js:58:31)
at Object.<anonymous> (/sandbox/index.js:31:11)
at Module._compile (internal/modules/cjs/loader.js:778:30)
if you switch true into false on line 28
if (true) {
// ->
if (false) {
you will see that the app starts just fine with the same typeDefs. This has been broken for months now and I hoped it was some easy oversight that would get fixed shortly, but for some reason, this is still broken. I tried to fix it myself but to be honest that piece of code is a rabbit hole of weird transformations. It's really hard to understand WHY all that stuff is happening - and one downside of what happens there is the duplication of some types, like that one.
Apollo federation won't start if I try to use directives like so:
Error: Schema must contain uniquely named types but contains multiple types named "AdditionalEntityFields".
This is a valid schema.
A short, but descriptive title. The title doesn't need "Apollo" in it.
The package name and version of Apollo showing the problem.
"@apollo/federation": "0.19.1"
If applicable, the last version of Apollo where the problem did not occur.
No idea.
The expected behavior.
It should accept a correct schema with non-scalar directive arguments.
https://codesandbox.io/s/elated-mirzakhani-wnwkk?file=/index.js:621-702
if you switch true into false on line 28
you will see that the app starts just fine with the same typeDefs. This has been broken for months now and I hoped it was some easy oversight that would get fixed shortly, but for some reason, this is still broken. I tried to fix it myself but to be honest that piece of code is a rabbit hole of weird transformations. It's really hard to understand WHY all that stuff is happening - and one downside of what happens there is the duplication of some types, like that one.