Skip to content

Commit

Permalink
backport: Preserve deprecationReason on GraphQLInputFields
Browse files Browse the repository at this point in the history
Backported from #3257

Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>
  • Loading branch information
trevor-scheer and IvanGoncharov committed Sep 6, 2021
1 parent acc468b commit 4f53143
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/type/__tests__/definition-test.js
Expand Up @@ -856,6 +856,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', () => {
Expand Down
1 change: 1 addition & 0 deletions src/type/definition.js
Expand Up @@ -1546,6 +1546,7 @@ export class GraphQLInputObjectType {
description: field.description,
type: field.type,
defaultValue: field.defaultValue,
deprecationReason: field.deprecationReason,
extensions: field.extensions,
astNode: field.astNode,
}));
Expand Down

0 comments on commit 4f53143

Please sign in to comment.