Skip to content

Commit b458be8

Browse files
IvanGoncharovyaacovCR
authored andcommitted
GraphQLInputObjectType: remove check that duplicate TS types (#3875)
1 parent 232ceba commit b458be8

2 files changed

Lines changed: 9 additions & 44 deletions

File tree

src/type/__tests__/definition-test.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -566,34 +566,6 @@ describe('Type System: Input Objects', () => {
566566
});
567567
});
568568

569-
describe('Input Object fields must not have resolvers', () => {
570-
it('rejects an Input Object type with resolvers', () => {
571-
const inputObjType = new GraphQLInputObjectType({
572-
name: 'SomeInputObject',
573-
fields: {
574-
// @ts-expect-error (Input fields cannot have resolvers)
575-
f: { type: ScalarType, resolve: dummyFunc },
576-
},
577-
});
578-
expect(() => inputObjType.getFields()).to.throw(
579-
'SomeInputObject.f field has a resolve property, but Input Types cannot define resolvers.',
580-
);
581-
});
582-
583-
it('rejects an Input Object type with resolver constant', () => {
584-
const inputObjType = new GraphQLInputObjectType({
585-
name: 'SomeInputObject',
586-
fields: {
587-
// @ts-expect-error (Input fields cannot have resolvers)
588-
f: { type: ScalarType, resolve: {} },
589-
},
590-
});
591-
expect(() => inputObjType.getFields()).to.throw(
592-
'SomeInputObject.f field has a resolve property, but Input Types cannot define resolvers.',
593-
);
594-
});
595-
});
596-
597569
it('Deprecation reason is preserved on fields', () => {
598570
const inputObjType = new GraphQLInputObjectType({
599571
name: 'SomeInputObject',

src/type/definition.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,22 +1573,15 @@ function defineInputFieldMap(
15731573
config: Readonly<GraphQLInputObjectTypeConfig>,
15741574
): GraphQLInputFieldMap {
15751575
const fieldMap = resolveObjMapThunk(config.fields);
1576-
return mapValue(fieldMap, (fieldConfig, fieldName) => {
1577-
devAssert(
1578-
!('resolve' in fieldConfig),
1579-
`${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`,
1580-
);
1581-
1582-
return {
1583-
name: assertName(fieldName),
1584-
description: fieldConfig.description,
1585-
type: fieldConfig.type,
1586-
defaultValue: fieldConfig.defaultValue,
1587-
deprecationReason: fieldConfig.deprecationReason,
1588-
extensions: toObjMap(fieldConfig.extensions),
1589-
astNode: fieldConfig.astNode,
1590-
};
1591-
});
1576+
return mapValue(fieldMap, (fieldConfig, fieldName) => ({
1577+
name: assertName(fieldName),
1578+
description: fieldConfig.description,
1579+
type: fieldConfig.type,
1580+
defaultValue: fieldConfig.defaultValue,
1581+
deprecationReason: fieldConfig.deprecationReason,
1582+
extensions: toObjMap(fieldConfig.extensions),
1583+
astNode: fieldConfig.astNode,
1584+
}));
15921585
}
15931586

15941587
export interface GraphQLInputObjectTypeConfig {

0 commit comments

Comments
 (0)