Skip to content

Commit 83e82d1

Browse files
committed
more wip
1 parent af4bdaa commit 83e82d1

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

src/type/__tests__/definition-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ describe('Type System: Input Objects', () => {
752752
description: undefined,
753753
type: ScalarType,
754754
defaultValue: undefined,
755+
deprecationReason: undefined,
755756
isDeprecated: false,
756757
extensions: undefined,
757758
astNode: undefined,
@@ -774,6 +775,7 @@ describe('Type System: Input Objects', () => {
774775
defaultValue: undefined,
775776
extensions: undefined,
776777
isDeprecated: false,
778+
deprecationReason: undefined,
777779
astNode: undefined,
778780
},
779781
});

src/type/definition.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,8 @@ export function argsToArgsConfig(
875875
description: arg.description,
876876
type: arg.type,
877877
defaultValue: arg.defaultValue,
878+
deprecationReason: arg.deprecationReason,
879+
isDeprecated: arg.deprecationReason != null,
878880
extensions: arg.extensions,
879881
astNode: arg.astNode,
880882
}),
@@ -952,6 +954,7 @@ export type GraphQLArgumentConfig = {|
952954
defaultValue?: mixed,
953955
extensions?: ?ReadOnlyObjMapLike<mixed>,
954956
deprecationReason?: ?string,
957+
isDeprecated?: boolean,
955958
astNode?: ?InputValueDefinitionNode,
956959
|};
957960

@@ -1535,11 +1538,12 @@ function defineInputFieldMap(
15351538
);
15361539

15371540
return {
1538-
isDeprecated: fieldConfig.deprecationReason != null,
15391541
name: fieldName,
15401542
description: fieldConfig.description,
15411543
type: fieldConfig.type,
15421544
defaultValue: fieldConfig.defaultValue,
1545+
deprecationReason: fieldConfig.deprecationReason,
1546+
isDeprecated: fieldConfig.deprecationReason != null,
15431547
extensions: fieldConfig.extensions && toObjMap(fieldConfig.extensions),
15441548
astNode: fieldConfig.astNode,
15451549
};

src/utilities/__tests__/buildASTSchema-test.js

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

785785
const newInput = inputFields.newInput;
786-
expect(newInput.isDeprecated).to.equal(false);
786+
expect(newInput).to.include({
787+
isDeprecated: false,
788+
});
787789

788790
const oldInput = inputFields.oldInput;
789-
expect(oldInput.isDeprecated).to.equal(true);
790-
expect(oldInput.deprecationReason).to.equal('No longer supported');
791+
expect(oldInput).to.include({
792+
isDeprecated: true,
793+
deprecationReason: 'No longer supported',
794+
});
791795

792796
const otherInput = inputFields.otherInput;
793-
expect(otherInput.isDeprecated).to.equal(true);
794-
expect(otherInput.deprecationReason).to.equal('Use newInput');
797+
expect(otherInput).to.include({
798+
isDeprecated: true,
799+
deprecationReason: 'Use newInput',
800+
});
795801

796802
const field3OldArg = rootFields.field3.args[0];
797-
expect(field3OldArg.isDeprecated).to.equal(true);
798-
expect(field3OldArg.deprecationReason).to.equal('No longer supported');
803+
expect(field3OldArg).to.include({
804+
isDeprecated: true,
805+
deprecationReason: 'No longer supported',
806+
});
799807

800808
const field4OldArg = rootFields.field4.args[0];
801-
expect(field4OldArg.isDeprecated).to.equal(true);
802-
expect(field4OldArg.deprecationReason).to.equal('why not?');
809+
expect(field4OldArg).to.include({
810+
isDeprecated: true,
811+
deprecationReason: 'Why not?',
812+
});
803813
});
804814

805815
it('Correctly extend scalar type', () => {

0 commit comments

Comments
 (0)