@cran/gql.core
Version:
Cran/GraphQL Core Utilities
13 lines (12 loc) • 546 B
JavaScript
import { GraphQLSchema } from "graphql/type/schema";
import { parse } from "graphql/language/parser";
import { typeFromAST } from "graphql/utilities/typeFromAST";
const original = GraphQLSchema.prototype.getType;
GraphQLSchema.prototype.getType = function getType(name) {
let type = original.call(this, name);
// prevent internal checks failing (apollo federation looks for _Service)
if (!type && "_" !== name[0]) {
type = typeFromAST(this, parse(`type t{t:${name}}`).definitions[0].fields[0].type);
}
return type;
};