-
Notifications
You must be signed in to change notification settings - Fork 28
/
changes.rb
1096 lines (889 loc) · 32.6 KB
/
changes.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
require 'graphql/schema_comparator/changes/criticality'
require 'graphql/schema_comparator/changes/safe_type_change'
module GraphQL
module SchemaComparator
module Changes
# Base class for change objects
class AbstractChange
# A message describing the change that happened between the two version
# @return [String] The change message
def message
raise NotImplementedError
end
# @return [Boolean] If the change is breaking or not
def breaking?
criticality.breaking?
end
# @return [Boolean] If the change is dangerous or not
def dangerous?
criticality.dangerous?
end
# @return [Boolean] If the change is non breaking
def non_breaking?
criticality.non_breaking?
end
# @return [GraphQL::SchemaComparator::Changes::Criticality] The criticality of this change
def criticality
raise NotImplementedError
end
# @return [String] Dot-delimited path to the affected schema member.
def path
raise NotImplementedError
end
end
# Mostly breaking changes
class TypeRemoved < AbstractChange
attr_reader :removed_type, :criticality
def initialize(removed_type)
@removed_type = removed_type
@criticality = Changes::Criticality.breaking(
reason: "Removing a type is a breaking change. It is preferable to deprecate and remove all references to this type first."
)
end
def message
"Type `#{removed_type.graphql_name}` was removed"
end
def path
removed_type.path
end
end
class DirectiveRemoved < AbstractChange
attr_reader :directive, :criticality
def initialize(directive)
@directive = directive
@criticality = Changes::Criticality.breaking
end
def message
"Directive `#{directive.graphql_name}` was removed"
end
def path
"@#{directive.graphql_name}"
end
end
class TypeKindChanged < AbstractChange
attr_reader :old_type, :new_type, :criticality
def initialize(old_type, new_type)
@old_type = old_type
@new_type = new_type
@criticality = Changes::Criticality.breaking(
reason: "Changing the kind of a type is a breaking change because it can cause existing queries to error. For example, turning an object type to a scalar type would break queries that define a selection set for this type."
)
end
def message
"`#{old_type.graphql_name}` kind changed from `#{old_type.kind}` to `#{new_type.kind}`"
end
def path
old_type.path
end
end
class EnumValueRemoved < AbstractChange
attr_reader :enum_value, :enum_type, :criticality
def initialize(enum_type, enum_value, usage)
@enum_value = enum_value
@enum_type = enum_type
@criticality = if usage.input?
Changes::Criticality.breaking(
reason: "Removing an enum value will cause existing queries that use this enum value to error."
)
else
Changes::Criticality.non_breaking(
reason: "Removing an enum value for enums used only in outputs is non-breaking."
)
end
end
def message
"Enum value `#{enum_value.graphql_name}` was removed from enum `#{enum_type.graphql_name}`"
end
def path
enum_value.path
end
end
class UnionMemberRemoved < AbstractChange
attr_reader :union_type, :union_member, :criticality
def initialize(union_type, union_member)
@union_member = union_member
@union_type = union_type
@criticality = Changes::Criticality.breaking(
reason: "Removing a union member from a union can cause existing queries that use this union member in a fragment spread to error."
)
end
def message
"Union member `#{union_member.graphql_name}` was removed from Union type `#{union_type.graphql_name}`"
end
def path
union_type.path
end
end
class InputFieldRemoved < AbstractChange
attr_reader :input_object_type, :field, :criticality
def initialize(input_object_type, field)
@input_object_type = input_object_type
@field = field
@criticality = Changes::Criticality.breaking(
reason: "Removing an input field will cause existing queries that use this input field to error."
)
end
def message
"Input field `#{field.graphql_name}` was removed from input object type `#{input_object_type.graphql_name}`"
end
def path
field.path
end
end
class FieldArgumentRemoved < AbstractChange
attr_reader :object_type, :field, :argument, :criticality
def initialize(object_type, field, argument)
@object_type = object_type
@field = field
@argument = argument
@criticality = Changes::Criticality.breaking(
reason: "Removing a field argument is a breaking change because it will cause existing queries that use this argument to error."
)
end
def message
"Argument `#{argument.graphql_name}: #{argument.type.to_type_signature}` was removed from field `#{object_type.graphql_name}.#{field.graphql_name}`"
end
def path
argument.path
end
end
class DirectiveArgumentRemoved < AbstractChange
attr_reader :directive, :argument, :criticality
def initialize(directive, argument)
@directive = directive
@argument = argument
@criticality = Changes::Criticality.breaking
end
def message
"Argument `#{argument.graphql_name}` was removed from directive `#{directive.graphql_name}`"
end
def path
["@#{directive.graphql_name}", argument.graphql_name].join('.')
end
end
class RootOperationTypeAdded < AbstractChange
attr_reader :new_schema, :operation_type, :criticality
def initialize(new_schema:, operation_type:)
@new_schema = new_schema
@operation_type = operation_type
@criticality = Changes::Criticality.non_breaking(
reason: "Adding a schema #{operation_type} root is considered non-breaking."
)
end
def message
"Schema #{operation_type} root `#{operation_type_name}` was added"
end
def path
operation_type_name
end
def operation_type_name
case operation_type
when :query
new_schema.query.graphql_name
when :mutation
new_schema.mutation.graphql_name
when :subscription
new_schema.subscription.graphql_name
end
end
end
class RootOperationTypeChanged < AbstractChange
attr_reader :old_schema, :new_schema, :operation_type, :criticality
def initialize(old_schema:, new_schema:, operation_type:)
@old_schema = old_schema
@new_schema = new_schema
@operation_type = operation_type
@criticality = Changes::Criticality.breaking
end
def message
"Schema #{operation_type} root has changed from `#{operation_type_name(old_schema)}` to `#{operation_type_name(new_schema)}`"
end
def path
operation_type_name(old_schema)
end
def operation_type_name(schema)
case operation_type
when :query
schema.query.graphql_name
when :mutation
schema.mutation.graphql_name
when :subscription
schema.subscription.graphql_name
end
end
end
class RootOperationTypeRemoved < AbstractChange
attr_reader :old_schema, :operation_type, :criticality
def initialize(old_schema:, operation_type:)
@old_schema = old_schema
@operation_type = operation_type
@criticality = Changes::Criticality.breaking
end
def message
"Schema #{operation_type} root `#{operation_type_name}` was removed"
end
def path
operation_type_name
end
def operation_type_name
case operation_type
when :query
old_schema.query.graphql_name
when :mutation
old_schema.mutation.graphql_name
when :subscription
old_schema.subscription.graphql_name
end
end
end
class FieldRemoved < AbstractChange
attr_reader :object_type, :field, :criticality
def initialize(object_type, field)
@object_type = object_type
@field = field
if field.deprecation_reason
@criticality = Changes::Criticality.breaking(
reason: "Removing a deprecated field is a breaking change. Before removing it, you may want" \
"to look at the field's usage to see the impact of removing the field."
)
else
@criticality = Changes::Criticality.breaking(
reason: "Removing a field is a breaking change. It is preferable to deprecate the field before removing it."
)
end
end
def message
"Field `#{field.graphql_name}` was removed from object type `#{object_type.graphql_name}`"
end
def path
[object_type.graphql_name, field.graphql_name].join(".")
end
end
class DirectiveLocationRemoved < AbstractChange
attr_reader :directive, :location, :criticality
def initialize(directive, location)
@directive = directive
@location = location
@criticality = Changes::Criticality.breaking
end
def message
"Location `#{location}` was removed from directive `#{directive.graphql_name}`"
end
def path
"@#{directive.graphql_name}"
end
end
class ObjectTypeInterfaceRemoved < AbstractChange
attr_reader :interface, :object_type, :criticality
def initialize(interface, object_type)
@interface = interface
@object_type = object_type
@criticality = Changes::Criticality.breaking(
reason: "Removing an interface from an object type can cause existing queries that use this in a fragment spread to error."
)
end
def message
"`#{object_type.graphql_name}` object type no longer implements `#{interface.graphql_name}` interface"
end
def path
object_type.path
end
end
class FieldTypeChanged < AbstractChange
include SafeTypeChange
attr_reader :type, :old_field, :new_field
def initialize(type, old_field, new_field)
@type = type
@old_field = old_field
@new_field = new_field
end
def message
"Field `#{old_field.path}` changed type from `#{old_field.type.to_type_signature}` to `#{new_field.type.to_type_signature}`"
end
def criticality
if safe_change_for_field?(old_field.type, new_field.type)
Changes::Criticality.non_breaking
else
Changes::Criticality.breaking # TODO - Add reason
end
end
def path
old_field.path
end
end
class InputFieldTypeChanged < AbstractChange
include SafeTypeChange
attr_reader :input_type, :old_input_field, :new_input_field, :criticality
def initialize(input_type, old_input_field, new_input_field)
if safe_change_for_input_value?(old_input_field.type, new_input_field.type)
@criticality = Changes::Criticality.non_breaking(
reason: "Changing an input field from non-null to null is considered non-breaking"
)
else
@criticality = Changes::Criticality.breaking(
reason: "Changing the type of an input field can cause existing queries that use this field to error."
)
end
@input_type = input_type
@old_input_field = old_input_field
@new_input_field = new_input_field
end
def message
"Input field `#{path}` changed type from `#{old_input_field.type.to_type_signature}` to `#{new_input_field.type.to_type_signature}`"
end
def path
old_input_field.path
end
end
class FieldArgumentTypeChanged < AbstractChange
include SafeTypeChange
attr_reader :type, :field, :old_argument, :new_argument, :criticality
def initialize(type, field, old_argument, new_argument)
if safe_change_for_input_value?(old_argument.type, new_argument.type)
@criticality = Changes::Criticality.non_breaking(
reason: "Changing an input field from non-null to null is considered non-breaking"
)
else
@criticality = Changes::Criticality.breaking(
reason: "Changing the type of a field's argument can cause existing queries that use this argument to error."
)
end
@type = type
@field = field
@old_argument = old_argument
@new_argument = new_argument
end
def message
"Type for argument `#{new_argument.graphql_name}` on field `#{field.path}` changed"\
" from `#{old_argument.type.to_type_signature}` to `#{new_argument.type.to_type_signature}`"
end
def path
old_argument.path
end
end
class DirectiveArgumentTypeChanged < AbstractChange
include SafeTypeChange
attr_reader :directive, :old_argument, :new_argument, :criticality
def initialize(directive, old_argument, new_argument)
if safe_change_for_input_value?(old_argument.type, new_argument.type)
@criticality = Changes::Criticality.non_breaking(
reason: "Changing an input field from non-null to null is considered non-breaking"
)
else
@criticality = Changes::Criticality.breaking
end
@directive = directive
@old_argument = old_argument
@new_argument = new_argument
end
def message
"Type for argument `#{new_argument.graphql_name}` on directive `#{directive.graphql_name}` changed"\
" from `#{old_argument.type.to_type_signature}` to `#{new_argument.type.to_type_signature}`"
end
def path
["@#{directive.graphql_name}", old_argument.graphql_name].join('.')
end
end
# Dangerous Changes
class FieldArgumentDefaultChanged < AbstractChange
attr_reader :type, :field, :old_argument, :new_argument, :criticality
def initialize(type, field, old_argument, new_argument)
@type = type
@field = field
@old_argument = old_argument
@new_argument = new_argument
@criticality = Changes::Criticality.dangerous(
reason: "Changing the default value for an argument may change the runtime " \
"behaviour of a field if it was never provided."
)
end
def message
if old_argument.default_value?
"Default value for argument `#{new_argument.graphql_name}` on field `#{field.path}` changed"\
" from `#{old_argument.default_value}` to `#{new_argument.default_value}`"
else
"Default value `#{new_argument.default_value}` was added to argument `#{new_argument.graphql_name}` on field `#{field.path}`"
end
end
def path
old_argument.path
end
end
class InputFieldDefaultChanged < AbstractChange
attr_reader :input_type, :old_field, :new_field, :criticality
def initialize(input_type, old_field, new_field)
@criticality = Changes::Criticality.dangerous(
reason: "Changing the default value for an argument may change the runtime " \
"behaviour of a field if it was never provided."
)
@input_type = input_type
@old_field = old_field
@new_field = new_field
end
def message
"Input field `#{path}` default changed"\
" from `#{old_field.default_value}` to `#{new_field.default_value}`"
end
def path
old_field.path
end
end
class DirectiveArgumentDefaultChanged < AbstractChange
attr_reader :directive, :old_argument, :new_argument, :criticality
def initialize(directive, old_argument, new_argument)
@criticality = Changes::Criticality.dangerous(
reason: "Changing the default value for an argument may change the runtime " \
"behaviour of a field if it was never provided."
)
@directive = directive
@old_argument = old_argument
@new_argument = new_argument
end
def message
if old_argument.default_value?
"Default value for argument `#{new_argument.graphql_name}` on directive `#{directive.graphql_name}` changed"\
" from `#{old_argument.default_value}` to `#{new_argument.default_value}`"
else
"Default value `#{new_argument.default_value}` was added to argument `#{new_argument.graphql_name}` on directive `#{directive.graphql_name}`"
end
end
def path
["@#{directive.graphql_name}", new_argument.graphql_name].join(".")
end
end
class EnumValueAdded < AbstractChange
attr_reader :enum_type, :enum_value, :criticality
def initialize(enum_type, enum_value, usage)
@enum_type = enum_type
@enum_value = enum_value
@criticality = if usage.output?
Changes::Criticality.dangerous(
reason: "Adding an enum value may break existing clients that were not " \
"programmed defensively against an added case when querying an enum."
)
else
Changes::Criticality.non_breaking(
reason: "Adding an enum value for enums used only in inputs is non-breaking."
)
end
end
def message
"Enum value `#{enum_value.graphql_name}` was added to enum `#{enum_type.graphql_name}`"
end
def path
enum_value.path
end
end
class UnionMemberAdded < AbstractChange
attr_reader :union_type, :union_member, :criticality
def initialize(union_type, union_member)
@union_member = union_member
@union_type = union_type
@criticality = Changes::Criticality.dangerous(
reason: "Adding a possible type to Unions may break existing clients " \
"that were not programming defensively against a new possible type."
)
end
def message
"Union member `#{union_member.graphql_name}` was added to Union type `#{union_type.graphql_name}`"
end
def path
union_type.path
end
end
class ObjectTypeInterfaceAdded < AbstractChange
attr_reader :interface, :object_type, :criticality
def initialize(interface, object_type)
@criticality = Changes::Criticality.dangerous(
reason: "Adding an interface to an object type may break existing clients " \
"that were not programming defensively against a new possible type."
)
@interface = interface
@object_type = object_type
end
def message
"`#{object_type.graphql_name}` object implements `#{interface.graphql_name}` interface"
end
def path
object_type.path
end
end
# Mostly Non-Breaking Changes
class InputFieldAdded < AbstractChange
attr_reader :input_object_type, :field, :criticality
def initialize(input_object_type, field)
@criticality = if field.type.non_null? && !field.default_value?
Changes::Criticality.breaking(reason: "Adding a non-null input field without a default value to an existing input type will cause existing queries that use this input type to error because they will not provide a value for this new field.")
else
Changes::Criticality.non_breaking
end
@input_object_type = input_object_type
@field = field
end
def message
"Input field `#{field.graphql_name}` was added to input object type `#{input_object_type.graphql_name}`"
end
def path
field.path
end
end
class FieldArgumentAdded < AbstractChange
attr_reader :type, :field, :argument, :criticality
def initialize(type, field, argument)
@criticality = if argument.type.non_null? && !argument.default_value?
Changes::Criticality.breaking(reason: "Adding a required argument without a default value to an existing field is a breaking change because it will cause existing uses of this field to error.")
else
Changes::Criticality.non_breaking
end
@type = type
@field = field
@argument = argument
end
def message
"Argument `#{argument.graphql_name}: #{argument.type.graphql_name}` added to field `#{field.path}`"
end
def path
argument.path
end
end
class TypeAdded < AbstractChange
attr_reader :type, :criticality
def initialize(type)
@type = type
@criticality = Changes::Criticality.non_breaking
end
def message
"Type `#{type.graphql_name}` was added"
end
def path
type.path
end
end
class DirectiveAdded < AbstractChange
attr_reader :directive, :criticality
def initialize(directive)
@directive = directive
@criticality = Changes::Criticality.non_breaking
end
def message
"Directive `#{directive.graphql_name}` was added"
end
def path
"@#{directive.graphql_name}"
end
end
class TypeDescriptionChanged < AbstractChange
attr_reader :old_type, :new_type, :criticality
def initialize(old_type, new_type)
@old_type = old_type
@new_type = new_type
@criticality = Changes::Criticality.non_breaking
end
def message
"Description `#{old_type.description}` on type `#{old_type.graphql_name}` has changed to `#{new_type.description}`"
end
def path
old_type.path
end
end
class EnumValueDescriptionChanged < AbstractChange
attr_reader :enum, :old_enum_value, :new_enum_value, :criticality
def initialize(enum, old_enum_value, new_enum_value)
@enum = enum
@old_enum_value = old_enum_value
@new_enum_value = new_enum_value
@criticality = Changes::Criticality.non_breaking
end
def message
"Description for enum value `#{new_enum_value.path}` changed from " \
"`#{old_enum_value.description}` to `#{new_enum_value.description}`"
end
def path
old_enum_value.path
end
end
class EnumValueDeprecated < AbstractChange
attr_reader :enum, :old_enum_value, :new_enum_value, :criticality
def initialize(enum, old_enum_value, new_enum_value)
@criticality = Changes::Criticality.non_breaking
@enum = enum
@old_enum_value = old_enum_value
@new_enum_value = new_enum_value
end
def message
if old_enum_value.deprecation_reason
"Enum value `#{new_enum_value.path}` deprecation reason changed " \
"from `#{old_enum_value.deprecation_reason}` to `#{new_enum_value.deprecation_reason}`"
else
"Enum value `#{new_enum_value.path}` was deprecated with reason `#{new_enum_value.deprecation_reason}`"
end
end
def path
old_enum_value.path
end
end
class InputFieldDescriptionChanged < AbstractChange
attr_reader :input_type, :old_field, :new_field, :criticality
def initialize(input_type, old_field, new_field)
@criticality = Changes::Criticality.non_breaking
@input_type = input_type
@old_field = old_field
@new_field = new_field
end
def message
"Input field `#{old_field.path}` description changed"\
" from `#{old_field.description}` to `#{new_field.description}`"
end
def path
old_field.path
end
end
class DirectiveDescriptionChanged < AbstractChange
attr_reader :old_directive, :new_directive, :criticality
def initialize(old_directive, new_directive)
@criticality = Changes::Criticality.non_breaking
@old_directive = old_directive
@new_directive = new_directive
end
def message
"Directive `#{new_directive.graphql_name}` description changed"\
" from `#{old_directive.description}` to `#{new_directive.description}`"
end
def path
"@#{old_directive.graphql_name}"
end
end
class FieldDescriptionChanged < AbstractChange
attr_reader :type, :old_field, :new_field, :criticality
def initialize(type, old_field, new_field)
@criticality = Changes::Criticality.non_breaking
@type = type
@old_field = old_field
@new_field = new_field
end
def message
"Field `#{old_field.path}` description changed"\
" from `#{old_field.description}` to `#{new_field.description}`"
end
def path
old_field.path
end
end
class FieldArgumentDescriptionChanged < AbstractChange
attr_reader :type, :field, :old_argument, :new_argument, :criticality
def initialize(type, field, old_argument, new_argument)
@criticality = Changes::Criticality.non_breaking
@type = type
@field = field
@old_argument = old_argument
@new_argument = new_argument
end
def message
"Description for argument `#{new_argument.graphql_name}` on field `#{field.path}` changed"\
" from `#{old_argument.description}` to `#{new_argument.description}`"
end
def path
old_argument.path
end
end
class DirectiveArgumentDescriptionChanged < AbstractChange
attr_reader :directive, :old_argument, :new_argument, :criticality
def initialize(directive, old_argument, new_argument)
@criticality = Changes::Criticality.non_breaking
@directive = directive
@old_argument = old_argument
@new_argument = new_argument
end
def message
"Description for argument `#{new_argument.graphql_name}` on directive `#{directive.graphql_name}` changed"\
" from `#{old_argument.description}` to `#{new_argument.description}`"
end
def path
["@#{directive.graphql_name}", old_argument.graphql_name].join(".")
end
end
class FieldDeprecationChanged < AbstractChange
attr_reader :type, :old_field, :new_field, :criticality
def initialize(type, old_field, new_field)
@criticality = Changes::Criticality.non_breaking
@type = type
@old_field = old_field
@new_field = new_field
end
def message
"Deprecation reason on field `#{new_field.path}` has changed "\
"from `#{old_field.deprecation_reason}` to `#{new_field.deprecation_reason}`"
end
def path
old_field.path
end
end
class FieldAdded < AbstractChange
attr_reader :object_type, :field, :criticality
def initialize(object_type, field)
@criticality = Changes::Criticality.non_breaking
@object_type = object_type
@field = field
end
def message
"Field `#{field.graphql_name}` was added to object type `#{object_type.graphql_name}`"
end
def path
[object_type.graphql_name, field.graphql_name].join(".")
end
end
class DirectiveLocationAdded < AbstractChange
attr_reader :directive, :location, :criticality
def initialize(directive, location)
@criticality = Changes::Criticality.non_breaking
@directive = directive
@location = location
end
def message
"Location `#{location}` was added to directive `#{directive.graphql_name}`"
end
def path
"@#{directive.graphql_name}"
end
end
# TODO
class FieldAstDirectiveAdded < AbstractChange
def initialize(*)
end
end
# TODO
class FieldAstDirectiveRemoved < AbstractChange
def initialize(*)
end
end
# TODO
class EnumValueAstDirectiveAdded < AbstractChange
def initialize(*)
end
end
# TODO
class EnumValueAstDirectiveRemoved < AbstractChange
def initialize(*)
end
end
# TODO
class InputFieldAstDirectiveAdded < AbstractChange
def initialize(*)
end
end
# TODO
class InputFieldAstDirectiveRemoved < AbstractChange
def initialize(*)
end
end
# TODO
class DirectiveArgumentAstDirectiveAdded < AbstractChange
def initialize(*)
end
end
# TODO
class DirectiveArgumentAstDirectiveRemoved < AbstractChange
def initialize(*)
end
end
# TODO
class FieldArgumentAstDirectiveAdded < AbstractChange
def initialize(*)
end
end
# TODO
class FieldArgumentAstDirectiveRemoved < AbstractChange
def initialize(*)
end
end
# TODO
class ObjectTypeAstDirectiveAdded < AbstractChange
def initialize(*)
end
end
# TODO
class ObjectTypeAstDirectiveRemoved < AbstractChange
def initialize(*)
end
end