Skip to content

Commit a6e6bfe

Browse files
committed
f
1 parent 019b6a9 commit a6e6bfe

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/utilities/__tests__/mapSchemaConfig-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -889,17 +889,17 @@ describe('mapSchemaConfig', () => {
889889
);
890890
});
891891

892-
it('allows adding a named type via addNamedType() and retrieving the new list via getNamedTypes', () => {
892+
it('allows adding a named type via setNamedType() and retrieving the new list via getNamedTypes', () => {
893893
const sdl = 'type SomeType';
894894

895895
const schema = buildSchema(sdl);
896896
const schemaConfig = schema.toConfig();
897897

898898
expectSchemaMapping(
899899
schemaConfig,
900-
({ addNamedType, getNamedTypes }) => ({
900+
({ setNamedType, getNamedTypes }) => ({
901901
[SchemaElementKind.SCHEMA]: (config) => {
902-
addNamedType(
902+
setNamedType(
903903
new GraphQLObjectType({ name: 'AnotherType', fields: {} }),
904904
);
905905
return {

src/utilities/extendSchema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@ export function extendSchemaImpl(
198198
}
199199

200200
return mapSchemaConfig(schemaConfig, (context) => {
201-
const { getNamedType, addNamedType, getNamedTypes } = context;
201+
const { getNamedType, setNamedType, getNamedTypes } = context;
202202
return {
203203
[SchemaElementKind.SCHEMA]: (config) => {
204204
for (const typeNode of typeDefs) {
205205
const type =
206206
stdTypeMap.get(typeNode.name.value) ?? buildNamedType(typeNode);
207-
addNamedType(type);
207+
setNamedType(type);
208208
}
209209

210210
const operationTypes = {

src/utilities/mapSchemaConfig.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type SchemaElementKind =
7171

7272
export interface MappedSchemaContext {
7373
getNamedType: (typeName: string) => GraphQLNamedType;
74-
addNamedType: (type: GraphQLNamedType) => void;
74+
setNamedType: (type: GraphQLNamedType) => void;
7575
getNamedTypes: () => ReadonlyArray<GraphQLNamedType>;
7676
}
7777

@@ -184,7 +184,7 @@ export function mapSchemaConfig(
184184
): GraphQLSchemaNormalizedConfig {
185185
const configMapperMap = configMapperMapFn({
186186
getNamedType,
187-
addNamedType,
187+
setNamedType,
188188
getNamedTypes,
189189
});
190190

@@ -249,7 +249,7 @@ export function mapSchemaConfig(
249249
return type;
250250
}
251251

252-
function addNamedType(type: GraphQLNamedType): void {
252+
function setNamedType(type: GraphQLNamedType): void {
253253
mappedTypeMap.set(type.name, type);
254254
}
255255

0 commit comments

Comments
 (0)