diff --git a/src/type/__tests__/definition-test.ts b/src/type/__tests__/definition-test.ts index 1cf4e4f397..7011937c97 100644 --- a/src/type/__tests__/definition-test.ts +++ b/src/type/__tests__/definition-test.ts @@ -818,6 +818,22 @@ describe('Type System: Input Objects', () => { ); }); }); + + it('Deprecation reason is preserved on fields', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { + deprecatedField: { + type: ScalarType, + deprecationReason: 'not used anymore', + }, + }, + }); + expect(inputObjType.toConfig()).to.have.nested.property( + 'fields.deprecatedField.deprecationReason', + 'not used anymore', + ); + }); }); describe('Type System: List', () => { diff --git a/src/type/definition.ts b/src/type/definition.ts index 6e5f0fe409..42b2b42a30 100644 --- a/src/type/definition.ts +++ b/src/type/definition.ts @@ -1648,6 +1648,7 @@ export class GraphQLInputObjectType { description: field.description, type: field.type, defaultValue: field.defaultValue, + deprecationReason: field.deprecationReason, extensions: field.extensions, astNode: field.astNode, }));