Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Preserve deprecationReason on GraphQLInputFields #3257

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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