graphql
Version:
A Query Language and Runtime which can target any service.
13 lines • 516 B
JavaScript
import { GraphQLError } from "../../error/GraphQLError.mjs";
export function KnownOperationTypesRule(context) {
const schema = context.getSchema();
return {
OperationDefinition(node) {
const operation = node.operation;
if (!schema.getRootType(operation)) {
context.reportError(new GraphQLError(`The ${operation} operation is not supported by the schema.`, { nodes: node }));
}
},
};
}
//# sourceMappingURL=KnownOperationTypesRule.js.map