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

Use reference-equality when filtering rules in buildSchemaFromSDL #1551

Merged
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- `apollo-env`
- <First `apollo-env` related entry goes here>
- `apollo-graphql`
- <First `apollo-graphql` related entry goes here>
- Use reference-equality, rather than `Function.prototype.name` string comparison, when omitting validation rules within `buildSchemaFromSDL`. [#1551](https://github.com/apollographql/apollo-tooling/pull/1551)
- `apollo-language-server`
- <First `apollo-language-server` related entry goes here>
- `apollo-tools`
Expand Down
15 changes: 11 additions & 4 deletions packages/apollo-graphql/src/schema/buildSchemaFromSDL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ import { isDocumentNode, isNode } from "../utilities/graphql";
import { GraphQLResolverMap } from "./resolverMap";
import { GraphQLSchemaValidationError } from "./GraphQLSchemaValidationError";
import { specifiedSDLRules } from "graphql/validation/specifiedRules";
import {
KnownTypeNamesRule,
UniqueDirectivesPerLocationRule
} from "graphql/validation";
// Currently, this PossibleTypeExtensions rule is experimental and thus not
// exposed directly from the rules module above. This may change in the future!
import { PossibleTypeExtensions } from "graphql/validation/rules/PossibleTypeExtensions";
import { mapValues, isNotNullOrUndefined } from "apollo-env";

export interface GraphQLSchemaModule {
Expand All @@ -33,13 +40,13 @@ export interface GraphQLSchemaModule {
}

const skippedSDLRules = [
"PossibleTypeExtensions",
"KnownTypeNames",
"UniqueDirectivesPerLocation"
PossibleTypeExtensions,
KnownTypeNamesRule,
UniqueDirectivesPerLocationRule
];

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

export function modulesFromSDL(
Expand Down