Skip to content
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
2 changes: 1 addition & 1 deletion packages/apollo-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"sha.js": "^2.4.11"
},
"peerDependencies": {
"graphql": "^14.2.1 || ^15.0.0"
"graphql": "^14.2.1 || ^15.0.0 || ^16.0.0"
},
"jest": {
"preset": "ts-jest",
Expand Down
15 changes: 15 additions & 0 deletions packages/apollo-graphql/src/schema/buildSchemaFromSDL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ try {
// by the version of `graphql` that is available to us.
}

// BREAKING AGAIN: PossibleTypeExtensions is finalized into PossibleTypeExtensionsRule in
// graphql 16. For compatible reason, try catch logic for 15 is kept with extra logic for 16.
try {
// Compatible for graphql-js@16
const PossibleTypeExtensionsRule =
require("graphql").PossibleTypeExtensionsRule;

if (PossibleTypeExtensionsRule) {
skippedSDLRules.push(PossibleTypeExtensionsRule);
}
} catch (e) {
// No need to fail in this case. Instead, if this validation rule is missing, we will assume its not used
// by the version of `graphql` that is available to us.
}

const sdlRules = specifiedSDLRules.filter(
(rule) => !skippedSDLRules.includes(rule)
);
Expand Down