Skip to content

Commit 2df59f1

Browse files
fix: Preserve deprecationReason on GraphQLInputFields (#3257)
Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>
1 parent 8423d33 commit 2df59f1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/type/__tests__/definition-test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,22 @@ describe('Type System: Input Objects', () => {
818818
);
819819
});
820820
});
821+
822+
it('Deprecation reason is preserved on fields', () => {
823+
const inputObjType = new GraphQLInputObjectType({
824+
name: 'SomeInputObject',
825+
fields: {
826+
deprecatedField: {
827+
type: ScalarType,
828+
deprecationReason: 'not used anymore',
829+
},
830+
},
831+
});
832+
expect(inputObjType.toConfig()).to.have.nested.property(
833+
'fields.deprecatedField.deprecationReason',
834+
'not used anymore',
835+
);
836+
});
821837
});
822838

823839
describe('Type System: List', () => {

src/type/definition.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,7 @@ export class GraphQLInputObjectType {
16481648
description: field.description,
16491649
type: field.type,
16501650
defaultValue: field.defaultValue,
1651+
deprecationReason: field.deprecationReason,
16511652
extensions: field.extensions,
16521653
astNode: field.astNode,
16531654
}));

0 commit comments

Comments
 (0)