Skip to content

Commit 1293dfa

Browse files
backport: Preserve deprecationReason on GraphQLInputFields (#3260)
Co-authored-by: Ivan Goncharov <[email protected]> Co-authored-by: Trevor Scheer <[email protected]>
1 parent acc468b commit 1293dfa

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/type/__tests__/definition-test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,22 @@ describe('Type System: Input Objects', () => {
856856
);
857857
});
858858
});
859+
860+
it('Deprecation reason is preserved on fields', () => {
861+
const inputObjType = new GraphQLInputObjectType({
862+
name: 'SomeInputObject',
863+
fields: {
864+
deprecatedField: {
865+
type: ScalarType,
866+
deprecationReason: 'not used anymore',
867+
},
868+
},
869+
});
870+
expect(inputObjType.toConfig()).to.have.nested.property(
871+
'fields.deprecatedField.deprecationReason',
872+
'not used anymore',
873+
);
874+
});
859875
});
860876

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

src/type/definition.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,7 @@ export class GraphQLInputObjectType {
15461546
description: field.description,
15471547
type: field.type,
15481548
defaultValue: field.defaultValue,
1549+
deprecationReason: field.deprecationReason,
15491550
extensions: field.extensions,
15501551
astNode: field.astNode,
15511552
}));

0 commit comments

Comments
 (0)