Skip to content

Commit 3948aa2

Browse files
committed
buildSchema: change implementation to simply extending empty schema
1 parent f93bb65 commit 3948aa2

File tree

7 files changed

+460
-562
lines changed

7 files changed

+460
-562
lines changed

src/utilities/__tests__/buildASTSchema-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ describe('Schema Builder', () => {
10671067
}
10681068
`;
10691069
expect(() => buildSchema(sdl, { assumeValidSDL: true })).to.throw(
1070-
'Type "UnknownType" not found in document.',
1070+
'Unknown type: "UnknownType".',
10711071
);
10721072
});
10731073

src/utilities/buildASTSchema.d.ts

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
11
import Maybe from '../tsutils/Maybe';
2-
import {
3-
DocumentNode,
4-
Location,
5-
StringValueNode,
6-
TypeDefinitionNode,
7-
NamedTypeNode,
8-
DirectiveDefinitionNode,
9-
FieldDefinitionNode,
10-
InputValueDefinitionNode,
11-
EnumValueDefinitionNode,
12-
TypeNode,
13-
} from '../language/ast';
14-
import {
15-
GraphQLNamedType,
16-
GraphQLFieldConfig,
17-
GraphQLInputField,
18-
GraphQLEnumValueConfig,
19-
GraphQLType,
20-
GraphQLArgumentConfig,
21-
GraphQLInputFieldConfig,
22-
} from '../type/definition';
23-
import { GraphQLDirective } from '../type/directives';
2+
import { DocumentNode } from '../language/ast';
243
import { Source } from '../language/source';
254
import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema';
265
import { ParseOptions } from '../language/parser';
27-
import { dedentBlockStringValue } from '../language/blockString';
286

297
interface BuildSchemaOptions extends GraphQLSchemaValidationOptions {
308
/**
@@ -66,44 +44,6 @@ export function buildASTSchema(
6644
options?: BuildSchemaOptions,
6745
): GraphQLSchema;
6846

69-
type TypeDefinitionsMap = { [key: string]: TypeDefinitionNode };
70-
type TypeResolver = (typeRef: NamedTypeNode) => GraphQLNamedType;
71-
72-
export class ASTDefinitionBuilder {
73-
constructor(options: Maybe<BuildSchemaOptions>, resolveType: TypeResolver);
74-
75-
getNamedType(node: NamedTypeNode): GraphQLNamedType;
76-
77-
getWrappedType(node: TypeNode): GraphQLType;
78-
79-
buildDirective(directive: DirectiveDefinitionNode): GraphQLDirective;
80-
81-
buildField(field: FieldDefinitionNode): GraphQLFieldConfig<any, any>;
82-
83-
buildArg(value: InputValueDefinitionNode): GraphQLArgumentConfig;
84-
85-
buildInputField(value: InputValueDefinitionNode): GraphQLInputFieldConfig;
86-
87-
buildEnumValue(value: EnumValueDefinitionNode): GraphQLEnumValueConfig;
88-
89-
buildType(node: NamedTypeNode | TypeDefinitionNode): GraphQLNamedType;
90-
}
91-
92-
/**
93-
* Given an ast node, returns its string description.
94-
* @deprecated: provided to ease adoption and will be removed in v16.
95-
*
96-
* Accepts options as a second argument:
97-
*
98-
* - commentDescriptions:
99-
* Provide true to use preceding comments as the description.
100-
*
101-
*/
102-
export function getDescription(
103-
node: { readonly description?: StringValueNode; readonly loc?: Location },
104-
options: Maybe<BuildSchemaOptions>,
105-
): string | undefined;
106-
10747
/**
10848
* A helper function to build a GraphQLSchema directly from a source
10949
* document.

0 commit comments

Comments
 (0)