Skip to content
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

Fix schema definition for federation 2 @link in schema-first #3112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ export interface IQuery {
foo(): Nullable<boolean> | Promise<Nullable<boolean>>;
}

export interface ISchema {
Query: IQuery;
}

type Nullable<T> = T | null;
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ export class User {
posts?: Nullable<Nullable<Post>[]>;
}

export class ISchema {
Query: IQuery;
}

type Nullable<T> = T | null;
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ export class User {
posts?: Nullable<Nullable<Post>[]>;
}

export class ISchema {
Query: IQuery;
}

type Nullable<T> = T | null;
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export class GraphQLFederationDefinitionsFactory extends GraphQLDefinitionsFacto
// This leads to duplicated IQuery interfaces
// see: https://github.com//issues/2344
const mergedDefinition = mergeTypeDefs([printSubgraphSchema(schema)], {
useSchemaDefinition: false,
// schema-first requires the schema definition to be included for federation 2 @link to function
useSchemaDefinition: true,
throwOnConflict: true,
commentDescriptions: true,
reverseDirectives: true,
Expand Down