Skip to content

Commit 19834d2

Browse files
modoscIvanGoncharov
authored andcommitted
more wip
1 parent 6b48310 commit 19834d2

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

src/type/__tests__/definition-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ describe('Type System: Input Objects', () => {
774774
description: undefined,
775775
type: ScalarType,
776776
defaultValue: undefined,
777+
deprecationReason: undefined,
777778
isDeprecated: false,
778779
extensions: undefined,
779780
astNode: undefined,
@@ -796,6 +797,7 @@ describe('Type System: Input Objects', () => {
796797
defaultValue: undefined,
797798
extensions: undefined,
798799
isDeprecated: false,
800+
deprecationReason: undefined,
799801
astNode: undefined,
800802
},
801803
});

src/type/definition.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,8 @@ export function argsToArgsConfig(
904904
description: arg.description,
905905
type: arg.type,
906906
defaultValue: arg.defaultValue,
907+
deprecationReason: arg.deprecationReason,
908+
isDeprecated: arg.deprecationReason != null,
907909
extensions: arg.extensions,
908910
astNode: arg.astNode,
909911
}),
@@ -981,6 +983,7 @@ export type GraphQLArgumentConfig = {|
981983
defaultValue?: mixed,
982984
extensions?: ?ReadOnlyObjMapLike<mixed>,
983985
deprecationReason?: ?string,
986+
isDeprecated?: boolean,
984987
astNode?: ?InputValueDefinitionNode,
985988
|};
986989

@@ -1584,11 +1587,12 @@ function defineInputFieldMap(
15841587
);
15851588

15861589
return {
1587-
isDeprecated: fieldConfig.deprecationReason != null,
15881590
name: fieldName,
15891591
description: fieldConfig.description,
15901592
type: fieldConfig.type,
15911593
defaultValue: fieldConfig.defaultValue,
1594+
deprecationReason: fieldConfig.deprecationReason,
1595+
isDeprecated: fieldConfig.deprecationReason != null,
15921596
extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions),
15931597
astNode: fieldConfig.astNode,
15941598
};

src/utilities/__tests__/buildASTSchema-test.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -793,23 +793,33 @@ describe('Schema Builder', () => {
793793
).getFields();
794794

795795
const newInput = inputFields.newInput;
796-
expect(newInput.isDeprecated).to.equal(false);
796+
expect(newInput).to.include({
797+
isDeprecated: false,
798+
});
797799

798800
const oldInput = inputFields.oldInput;
799-
expect(oldInput.isDeprecated).to.equal(true);
800-
expect(oldInput.deprecationReason).to.equal('No longer supported');
801+
expect(oldInput).to.include({
802+
isDeprecated: true,
803+
deprecationReason: 'No longer supported',
804+
});
801805

802806
const otherInput = inputFields.otherInput;
803-
expect(otherInput.isDeprecated).to.equal(true);
804-
expect(otherInput.deprecationReason).to.equal('Use newInput');
807+
expect(otherInput).to.include({
808+
isDeprecated: true,
809+
deprecationReason: 'Use newInput',
810+
});
805811

806812
const field3OldArg = rootFields.field3.args[0];
807-
expect(field3OldArg.isDeprecated).to.equal(true);
808-
expect(field3OldArg.deprecationReason).to.equal('No longer supported');
813+
expect(field3OldArg).to.include({
814+
isDeprecated: true,
815+
deprecationReason: 'No longer supported',
816+
});
809817

810818
const field4OldArg = rootFields.field4.args[0];
811-
expect(field4OldArg.isDeprecated).to.equal(true);
812-
expect(field4OldArg.deprecationReason).to.equal('why not?');
819+
expect(field4OldArg).to.include({
820+
isDeprecated: true,
821+
deprecationReason: 'Why not?',
822+
});
813823
});
814824

815825
it('Supports @specifiedBy', () => {

0 commit comments

Comments
 (0)