Skip to content

Commit

Permalink
fix: Preserve deprecationReason on GraphQLInputFields (#3257)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>
  • Loading branch information
trevor-scheer and IvanGoncharov committed Sep 6, 2021
1 parent 8423d33 commit 2df59f1
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.ts
Expand Up @@ -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', () => {
Expand Down
1 change: 1 addition & 0 deletions src/type/definition.ts
Expand Up @@ -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,
}));
Expand Down

0 comments on commit 2df59f1

Please sign in to comment.