graphql-schema_comparator 0.6.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/CHANGELOG.md +7 -0
- data/LICENSE.txt +1 -1
- data/graphql-schema_comparator.gemspec +1 -1
- data/lib/graphql/schema_comparator.rb +1 -1
- data/lib/graphql/schema_comparator/changes.rb +80 -80
- data/lib/graphql/schema_comparator/diff/argument.rb +1 -1
- data/lib/graphql/schema_comparator/diff/field.rb +1 -1
- data/lib/graphql/schema_comparator/diff/input_field.rb +1 -1
- data/lib/graphql/schema_comparator/diff/object_type.rb +8 -4
- data/lib/graphql/schema_comparator/diff/schema.rb +4 -4
- data/lib/graphql/schema_comparator/diff/union.rb +6 -2
- data/lib/graphql/schema_comparator/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2509d9e4c54c0fc03a3bb7ac0be19a6719dc9816
|
4
|
+
data.tar.gz: e46e96c320374eb79264b2ae4d2b97a5fc0e9717
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1c99f48526bfa42fc61a9b61e95a2f86c0e5c407d14340453b3063c3349283c5f591ce0a77c35a1925a71037e3fddb0122c9f26e123c0e224b2f7101de9223c
|
7
|
+
data.tar.gz: 6604b66c7c37a1a8c6c0bc8da067390c19e1e5e925e7a1ae2cdb1aa9a8391f0861fa15e8449888d9bc2fc7c1557334aa18aa45f3b591b318bc7c560b63a4827c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.0.0 (January 23 2020)
|
4
|
+
|
5
|
+
### Breaking Changes
|
6
|
+
|
7
|
+
- Add support for graphql-ruby 1.10.0+ (#28)
|
8
|
+
- Starting from 1.0.0 a minimum of graphql-ruby 1.10 is required
|
9
|
+
|
3
10
|
## 0.6.1 (May 21rst 2019)
|
4
11
|
|
5
12
|
- Added a bunch of reasons to breaking changes (#17)
|
data/LICENSE.txt
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = ["graphql-schema", "schema_comparator"]
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_dependency "graphql", "~> 1.
|
24
|
+
spec.add_dependency "graphql", "~> 1.10"
|
25
25
|
spec.add_dependency "thor", ">= 0.19", "< 2.0"
|
26
26
|
spec.add_dependency "bundler", ">= 1.14"
|
27
27
|
|
@@ -35,7 +35,7 @@ module GraphQL
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def self.parse_schema(schema)
|
38
|
-
if schema.
|
38
|
+
if schema.respond_to?(:ancestors) && schema.ancestors.include?(GraphQL::Schema)
|
39
39
|
schema
|
40
40
|
elsif schema.is_a?(String)
|
41
41
|
GraphQL::Schema.from_definition(schema)
|
@@ -51,11 +51,11 @@ module GraphQL
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def message
|
54
|
-
"Type `#{removed_type.
|
54
|
+
"Type `#{removed_type.graphql_definition}` was removed"
|
55
55
|
end
|
56
56
|
|
57
57
|
def path
|
58
|
-
removed_type.
|
58
|
+
removed_type.graphql_definition.to_s
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -68,11 +68,11 @@ module GraphQL
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def message
|
71
|
-
"Directive `#{directive.
|
71
|
+
"Directive `#{directive.graphql_name}` was removed"
|
72
72
|
end
|
73
73
|
|
74
74
|
def path
|
75
|
-
"@#{directive.
|
75
|
+
"@#{directive.graphql_name}"
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -88,11 +88,11 @@ module GraphQL
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def message
|
91
|
-
"`#{old_type.
|
91
|
+
"`#{old_type.graphql_definition}` kind changed from `#{old_type.kind}` to `#{new_type.kind}`"
|
92
92
|
end
|
93
93
|
|
94
94
|
def path
|
95
|
-
old_type.
|
95
|
+
old_type.graphql_definition.to_s
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -108,11 +108,11 @@ module GraphQL
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def message
|
111
|
-
"Enum value `#{enum_value.
|
111
|
+
"Enum value `#{enum_value.graphql_name}` was removed from enum `#{enum_type.graphql_definition}`"
|
112
112
|
end
|
113
113
|
|
114
114
|
def path
|
115
|
-
[enum_type.
|
115
|
+
[enum_type.graphql_definition, enum_value.graphql_name].join('.')
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -128,11 +128,11 @@ module GraphQL
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def message
|
131
|
-
"Union member `#{union_member.
|
131
|
+
"Union member `#{union_member.graphql_name}` was removed from Union type `#{union_type.graphql_definition}`"
|
132
132
|
end
|
133
133
|
|
134
134
|
def path
|
135
|
-
union_type.
|
135
|
+
union_type.graphql_definition.to_s
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -148,11 +148,11 @@ module GraphQL
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def message
|
151
|
-
"Input field `#{field.
|
151
|
+
"Input field `#{field.graphql_name}` was removed from input object type `#{input_object_type.graphql_definition}`"
|
152
152
|
end
|
153
153
|
|
154
154
|
def path
|
155
|
-
[input_object_type.
|
155
|
+
[input_object_type.graphql_definition, field.graphql_name].join('.')
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
@@ -169,11 +169,11 @@ module GraphQL
|
|
169
169
|
end
|
170
170
|
|
171
171
|
def message
|
172
|
-
"Argument `#{argument.
|
172
|
+
"Argument `#{argument.graphql_name}: #{argument.type.graphql_definition}` was removed from field `#{object_type.graphql_definition}.#{field.graphql_name}`"
|
173
173
|
end
|
174
174
|
|
175
175
|
def path
|
176
|
-
[object_type.
|
176
|
+
[object_type.graphql_definition, field.graphql_name, argument.graphql_name].join('.')
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
@@ -187,11 +187,11 @@ module GraphQL
|
|
187
187
|
end
|
188
188
|
|
189
189
|
def message
|
190
|
-
"Argument `#{argument.
|
190
|
+
"Argument `#{argument.graphql_name}` was removed from directive `#{directive.graphql_name}`"
|
191
191
|
end
|
192
192
|
|
193
193
|
def path
|
194
|
-
["@#{directive.
|
194
|
+
["@#{directive.graphql_name}", argument.graphql_name].join('.')
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
@@ -205,7 +205,7 @@ module GraphQL
|
|
205
205
|
end
|
206
206
|
|
207
207
|
def message
|
208
|
-
"Schema query root has changed from `#{old_schema.query.
|
208
|
+
"Schema query root has changed from `#{old_schema.query.graphql_name}` to `#{new_schema.query.graphql_name}`"
|
209
209
|
end
|
210
210
|
|
211
211
|
def path
|
@@ -233,11 +233,11 @@ module GraphQL
|
|
233
233
|
end
|
234
234
|
|
235
235
|
def message
|
236
|
-
"Field `#{field.
|
236
|
+
"Field `#{field.graphql_name}` was removed from object type `#{object_type.graphql_definition}`"
|
237
237
|
end
|
238
238
|
|
239
239
|
def path
|
240
|
-
[object_type.
|
240
|
+
[object_type.graphql_definition, field.graphql_name].join('.')
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
@@ -251,11 +251,11 @@ module GraphQL
|
|
251
251
|
end
|
252
252
|
|
253
253
|
def message
|
254
|
-
"Location `#{location}` was removed from directive `#{directive.
|
254
|
+
"Location `#{location}` was removed from directive `#{directive.graphql_name}`"
|
255
255
|
end
|
256
256
|
|
257
257
|
def path
|
258
|
-
"@#{directive.
|
258
|
+
"@#{directive.graphql_name}"
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
@@ -271,11 +271,11 @@ module GraphQL
|
|
271
271
|
end
|
272
272
|
|
273
273
|
def message
|
274
|
-
"`#{object_type.
|
274
|
+
"`#{object_type.graphql_definition}` object type no longer implements `#{interface.graphql_name}` interface"
|
275
275
|
end
|
276
276
|
|
277
277
|
def path
|
278
|
-
object_type.
|
278
|
+
object_type.graphql_definition.to_s
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
@@ -291,7 +291,7 @@ module GraphQL
|
|
291
291
|
end
|
292
292
|
|
293
293
|
def message
|
294
|
-
"Field `#{type}.#{old_field.
|
294
|
+
"Field `#{type.graphql_definition}.#{old_field.graphql_name}` changed type from `#{old_field.type.graphql_definition}` to `#{new_field.type.graphql_definition}`"
|
295
295
|
end
|
296
296
|
|
297
297
|
def criticality
|
@@ -303,7 +303,7 @@ module GraphQL
|
|
303
303
|
end
|
304
304
|
|
305
305
|
def path
|
306
|
-
[type.
|
306
|
+
[type.graphql_definition, old_field.graphql_name].join('.')
|
307
307
|
end
|
308
308
|
end
|
309
309
|
|
@@ -329,11 +329,11 @@ module GraphQL
|
|
329
329
|
end
|
330
330
|
|
331
331
|
def message
|
332
|
-
"Input field `#{input_type}.#{old_input_field.
|
332
|
+
"Input field `#{input_type.graphql_definition}.#{old_input_field.graphql_name}` changed type from `#{old_input_field.type.graphql_definition}` to `#{new_input_field.type.graphql_definition}`"
|
333
333
|
end
|
334
334
|
|
335
335
|
def path
|
336
|
-
[input_type.
|
336
|
+
[input_type.graphql_definition, old_input_field.graphql_name].join('.')
|
337
337
|
end
|
338
338
|
end
|
339
339
|
|
@@ -360,12 +360,12 @@ module GraphQL
|
|
360
360
|
end
|
361
361
|
|
362
362
|
def message
|
363
|
-
"Type for argument `#{new_argument.
|
364
|
-
" from `#{old_argument.type}` to `#{new_argument.type}`"
|
363
|
+
"Type for argument `#{new_argument.graphql_name}` on field `#{type.graphql_definition}.#{field.graphql_definition.name}` changed"\
|
364
|
+
" from `#{old_argument.type.graphql_definition}` to `#{new_argument.type.graphql_definition}`"
|
365
365
|
end
|
366
366
|
|
367
367
|
def path
|
368
|
-
[type.
|
368
|
+
[type.graphql_definition, field.graphql_definition.name, old_argument.graphql_name].join('.')
|
369
369
|
end
|
370
370
|
end
|
371
371
|
|
@@ -389,12 +389,12 @@ module GraphQL
|
|
389
389
|
end
|
390
390
|
|
391
391
|
def message
|
392
|
-
"Type for argument `#{new_argument.
|
393
|
-
" from `#{old_argument.type}` to `#{new_argument.type}`"
|
392
|
+
"Type for argument `#{new_argument.graphql_name}` on directive `#{directive.graphql_name}` changed"\
|
393
|
+
" from `#{old_argument.type.graphql_definition}` to `#{new_argument.type.graphql_definition}`"
|
394
394
|
end
|
395
395
|
|
396
396
|
def path
|
397
|
-
["@#{directive.
|
397
|
+
["@#{directive.graphql_name}", old_argument.graphql_name].join('.')
|
398
398
|
end
|
399
399
|
end
|
400
400
|
|
@@ -451,16 +451,16 @@ module GraphQL
|
|
451
451
|
end
|
452
452
|
|
453
453
|
def message
|
454
|
-
if old_argument.default_value.nil?
|
455
|
-
"Default value `#{new_argument.default_value}` was added to argument `#{new_argument.
|
454
|
+
if old_argument.default_value.nil? || old_argument.default_value == :__no_default__
|
455
|
+
"Default value `#{new_argument.default_value}` was added to argument `#{new_argument.graphql_name}` on field `#{type.graphql_definition}.#{field.graphql_name}`"
|
456
456
|
else
|
457
|
-
"Default value for argument `#{new_argument.
|
457
|
+
"Default value for argument `#{new_argument.graphql_name}` on field `#{type.graphql_definition}.#{field.name}` changed"\
|
458
458
|
" from `#{old_argument.default_value}` to `#{new_argument.default_value}`"
|
459
459
|
end
|
460
460
|
end
|
461
461
|
|
462
462
|
def path
|
463
|
-
[type.
|
463
|
+
[type.graphql_definition, field.graphql_name, old_argument.graphql_name].join('.')
|
464
464
|
end
|
465
465
|
end
|
466
466
|
|
@@ -478,12 +478,12 @@ module GraphQL
|
|
478
478
|
end
|
479
479
|
|
480
480
|
def message
|
481
|
-
"Input field `#{input_type.
|
481
|
+
"Input field `#{input_type.graphql_definition}.#{old_field.graphql_name}` default changed"\
|
482
482
|
" from `#{old_field.default_value}` to `#{new_field.default_value}`"
|
483
483
|
end
|
484
484
|
|
485
485
|
def path
|
486
|
-
[input_type.
|
486
|
+
[input_type.graphql_definition, old_field.graphql_name].join(".")
|
487
487
|
end
|
488
488
|
end
|
489
489
|
|
@@ -501,12 +501,12 @@ module GraphQL
|
|
501
501
|
end
|
502
502
|
|
503
503
|
def message
|
504
|
-
"Default value for argument `#{new_argument.
|
505
|
-
" from `#{old_argument.default_value}` to `#{new_argument.default_value}`"
|
504
|
+
"Default value for argument `#{new_argument.graphql_name}` on directive `#{directive.graphql_name}` changed"\
|
505
|
+
" from `#{old_argument.ast_node.default_value}` to `#{new_argument.ast_node.default_value}`"
|
506
506
|
end
|
507
507
|
|
508
508
|
def path
|
509
|
-
["@#{directive.
|
509
|
+
["@#{directive.graphql_name}", new_argument.graphql_name].join(".")
|
510
510
|
end
|
511
511
|
end
|
512
512
|
|
@@ -523,11 +523,11 @@ module GraphQL
|
|
523
523
|
end
|
524
524
|
|
525
525
|
def message
|
526
|
-
"Enum value `#{enum_value.
|
526
|
+
"Enum value `#{enum_value.graphql_name}` was added to enum `#{enum_type.graphql_definition}`"
|
527
527
|
end
|
528
528
|
|
529
529
|
def path
|
530
|
-
[enum_type.
|
530
|
+
[enum_type.graphql_definition, enum_value.graphql_name].join(".")
|
531
531
|
end
|
532
532
|
end
|
533
533
|
|
@@ -544,11 +544,11 @@ module GraphQL
|
|
544
544
|
end
|
545
545
|
|
546
546
|
def message
|
547
|
-
"Union member `#{union_member.
|
547
|
+
"Union member `#{union_member.graphql_name}` was added to Union type `#{union_type.graphql_definition}`"
|
548
548
|
end
|
549
549
|
|
550
550
|
def path
|
551
|
-
union_type.
|
551
|
+
union_type.graphql_definition.to_s
|
552
552
|
end
|
553
553
|
end
|
554
554
|
|
@@ -565,11 +565,11 @@ module GraphQL
|
|
565
565
|
end
|
566
566
|
|
567
567
|
def message
|
568
|
-
"`#{object_type.
|
568
|
+
"`#{object_type.graphql_definition}` object implements `#{interface.graphql_name}` interface"
|
569
569
|
end
|
570
570
|
|
571
571
|
def path
|
572
|
-
object_type.
|
572
|
+
object_type.graphql_definition.to_s
|
573
573
|
end
|
574
574
|
end
|
575
575
|
|
@@ -590,11 +590,11 @@ module GraphQL
|
|
590
590
|
end
|
591
591
|
|
592
592
|
def message
|
593
|
-
"Input field `#{field.
|
593
|
+
"Input field `#{field.graphql_name}` was added to input object type `#{input_object_type.graphql_definition}`"
|
594
594
|
end
|
595
595
|
|
596
596
|
def path
|
597
|
-
[input_object_type.
|
597
|
+
[input_object_type.graphql_definition, field.graphql_name].join(".")
|
598
598
|
end
|
599
599
|
end
|
600
600
|
|
@@ -614,11 +614,11 @@ module GraphQL
|
|
614
614
|
end
|
615
615
|
|
616
616
|
def message
|
617
|
-
"Argument `#{argument.
|
617
|
+
"Argument `#{argument.graphql_name}: #{argument.type.graphql_definition}` added to field `#{type.graphql_definition}.#{field.graphql_name}`"
|
618
618
|
end
|
619
619
|
|
620
620
|
def path
|
621
|
-
[type.
|
621
|
+
[type.graphql_definition, field.graphql_name, argument.graphql_name].join(".")
|
622
622
|
end
|
623
623
|
end
|
624
624
|
|
@@ -631,11 +631,11 @@ module GraphQL
|
|
631
631
|
end
|
632
632
|
|
633
633
|
def message
|
634
|
-
"Type `#{type.
|
634
|
+
"Type `#{type.graphql_definition}` was added"
|
635
635
|
end
|
636
636
|
|
637
637
|
def path
|
638
|
-
type.
|
638
|
+
type.graphql_definition.to_s
|
639
639
|
end
|
640
640
|
end
|
641
641
|
|
@@ -648,11 +648,11 @@ module GraphQL
|
|
648
648
|
end
|
649
649
|
|
650
650
|
def message
|
651
|
-
"Directive `#{directive.
|
651
|
+
"Directive `#{directive.graphql_name}` was added"
|
652
652
|
end
|
653
653
|
|
654
654
|
def path
|
655
|
-
"@#{directive.
|
655
|
+
"@#{directive.graphql_name}"
|
656
656
|
end
|
657
657
|
end
|
658
658
|
|
@@ -666,11 +666,11 @@ module GraphQL
|
|
666
666
|
end
|
667
667
|
|
668
668
|
def message
|
669
|
-
"Description `#{old_type.description}` on type `#{old_type.
|
669
|
+
"Description `#{old_type.description}` on type `#{old_type.graphql_definition}` has changed to `#{new_type.description}`"
|
670
670
|
end
|
671
671
|
|
672
672
|
def path
|
673
|
-
old_type.
|
673
|
+
old_type.graphql_definition.to_s
|
674
674
|
end
|
675
675
|
end
|
676
676
|
|
@@ -685,12 +685,12 @@ module GraphQL
|
|
685
685
|
end
|
686
686
|
|
687
687
|
def message
|
688
|
-
"Description for enum value `#{enum.
|
688
|
+
"Description for enum value `#{enum.graphql_name}.#{new_enum_value.graphql_name}` changed from " \
|
689
689
|
"`#{old_enum_value.description}` to `#{new_enum_value.description}`"
|
690
690
|
end
|
691
691
|
|
692
692
|
def path
|
693
|
-
[enum.
|
693
|
+
[enum.graphql_name, old_enum_value.graphql_name].join(".")
|
694
694
|
end
|
695
695
|
end
|
696
696
|
|
@@ -706,16 +706,16 @@ module GraphQL
|
|
706
706
|
|
707
707
|
def message
|
708
708
|
if old_enum_value.deprecation_reason
|
709
|
-
"Enum value `#{enum.
|
709
|
+
"Enum value `#{enum.graphql_name}.#{new_enum_value.graphql_name}` deprecation reason changed " \
|
710
710
|
"from `#{old_enum_value.deprecation_reason}` to `#{new_enum_value.deprecation_reason}`"
|
711
711
|
else
|
712
|
-
"Enum value `#{enum.
|
712
|
+
"Enum value `#{enum.graphql_name}.#{new_enum_value.graphql_name}` was deprecated with reason" \
|
713
713
|
" `#{new_enum_value.deprecation_reason}`"
|
714
714
|
end
|
715
715
|
end
|
716
716
|
|
717
717
|
def path
|
718
|
-
[enum.
|
718
|
+
[enum.graphql_name, old_enum_value.graphql_name].join(".")
|
719
719
|
end
|
720
720
|
end
|
721
721
|
|
@@ -730,12 +730,12 @@ module GraphQL
|
|
730
730
|
end
|
731
731
|
|
732
732
|
def message
|
733
|
-
"Input field `#{input_type.
|
733
|
+
"Input field `#{input_type.graphql_definition}.#{old_field.graphql_name}` description changed"\
|
734
734
|
" from `#{old_field.description}` to `#{new_field.description}`"
|
735
735
|
end
|
736
736
|
|
737
737
|
def path
|
738
|
-
[input_type.
|
738
|
+
[input_type.graphql_definition, old_field.graphql_name].join(".")
|
739
739
|
end
|
740
740
|
end
|
741
741
|
|
@@ -749,12 +749,12 @@ module GraphQL
|
|
749
749
|
end
|
750
750
|
|
751
751
|
def message
|
752
|
-
"Directive `#{new_directive.
|
752
|
+
"Directive `#{new_directive.graphql_name}` description changed"\
|
753
753
|
" from `#{old_directive.description}` to `#{new_directive.description}`"
|
754
754
|
end
|
755
755
|
|
756
756
|
def path
|
757
|
-
"@#{old_directive.
|
757
|
+
"@#{old_directive.graphql_name}"
|
758
758
|
end
|
759
759
|
end
|
760
760
|
|
@@ -769,12 +769,12 @@ module GraphQL
|
|
769
769
|
end
|
770
770
|
|
771
771
|
def message
|
772
|
-
"Field `#{type.
|
772
|
+
"Field `#{type.graphql_definition}.#{old_field.graphql_name}` description changed"\
|
773
773
|
" from `#{old_field.description}` to `#{new_field.description}`"
|
774
774
|
end
|
775
775
|
|
776
776
|
def path
|
777
|
-
[type.
|
777
|
+
[type.graphql_definition, old_field.graphql_name].join(".")
|
778
778
|
end
|
779
779
|
end
|
780
780
|
|
@@ -790,12 +790,12 @@ module GraphQL
|
|
790
790
|
end
|
791
791
|
|
792
792
|
def message
|
793
|
-
"Description for argument `#{new_argument.
|
793
|
+
"Description for argument `#{new_argument.graphql_name}` on field `#{type.graphql_definition}.#{field.graphql_name}` changed"\
|
794
794
|
" from `#{old_argument.description}` to `#{new_argument.description}`"
|
795
795
|
end
|
796
796
|
|
797
797
|
def path
|
798
|
-
[type.
|
798
|
+
[type.graphql_definition, field.graphql_name, old_argument.graphql_name].join(".")
|
799
799
|
end
|
800
800
|
end
|
801
801
|
|
@@ -810,12 +810,12 @@ module GraphQL
|
|
810
810
|
end
|
811
811
|
|
812
812
|
def message
|
813
|
-
"Description for argument `#{new_argument.
|
813
|
+
"Description for argument `#{new_argument.graphql_name}` on directive `#{directive.graphql_name}` changed"\
|
814
814
|
" from `#{old_argument.description}` to `#{new_argument.description}`"
|
815
815
|
end
|
816
816
|
|
817
817
|
def path
|
818
|
-
["@#{directive.
|
818
|
+
["@#{directive.graphql_name}", old_argument.graphql_name].join(".")
|
819
819
|
end
|
820
820
|
end
|
821
821
|
|
@@ -830,12 +830,12 @@ module GraphQL
|
|
830
830
|
end
|
831
831
|
|
832
832
|
def message
|
833
|
-
"Deprecation reason on field `#{type.
|
833
|
+
"Deprecation reason on field `#{type.graphql_definition}.#{new_field.graphql_name}` has changed "\
|
834
834
|
"from `#{old_field.deprecation_reason}` to `#{new_field.deprecation_reason}`"
|
835
835
|
end
|
836
836
|
|
837
837
|
def path
|
838
|
-
[type.
|
838
|
+
[type.graphql_definition, old_field.graphql_name].join(".")
|
839
839
|
end
|
840
840
|
end
|
841
841
|
|
@@ -849,11 +849,11 @@ module GraphQL
|
|
849
849
|
end
|
850
850
|
|
851
851
|
def message
|
852
|
-
"Field `#{field.
|
852
|
+
"Field `#{field.graphql_name}` was added to object type `#{object_type.graphql_definition}`"
|
853
853
|
end
|
854
854
|
|
855
855
|
def path
|
856
|
-
[object_type.
|
856
|
+
[object_type.graphql_definition, field.graphql_name].join(".")
|
857
857
|
end
|
858
858
|
end
|
859
859
|
|
@@ -867,11 +867,11 @@ module GraphQL
|
|
867
867
|
end
|
868
868
|
|
869
869
|
def message
|
870
|
-
"Location `#{location}` was added to directive `#{directive.
|
870
|
+
"Location `#{location}` was added to directive `#{directive.graphql_name}`"
|
871
871
|
end
|
872
872
|
|
873
873
|
def path
|
874
|
-
"@#{directive.
|
874
|
+
"@#{directive.graphql_name}"
|
875
875
|
end
|
876
876
|
end
|
877
877
|
|
@@ -1033,7 +1033,7 @@ module GraphQL
|
|
1033
1033
|
end
|
1034
1034
|
|
1035
1035
|
def message
|
1036
|
-
"Argument `#{argument.
|
1036
|
+
"Argument `#{argument.graphql_name}` was added to directive `#{directive.graphql_name}`"
|
1037
1037
|
end
|
1038
1038
|
end
|
1039
1039
|
end
|
@@ -21,7 +21,7 @@ module GraphQL
|
|
21
21
|
changes << Changes::FieldArgumentDefaultChanged.new(type, field, old_arg, new_arg)
|
22
22
|
end
|
23
23
|
|
24
|
-
if old_arg.type != new_arg.type
|
24
|
+
if old_arg.type.graphql_definition != new_arg.type.graphql_definition
|
25
25
|
changes << Changes::FieldArgumentTypeChanged.new(type, field, old_arg, new_arg)
|
26
26
|
end
|
27
27
|
|
@@ -24,7 +24,7 @@ module GraphQL
|
|
24
24
|
changes << Changes::FieldDeprecationChanged.new(new_type, old_field, new_field)
|
25
25
|
end
|
26
26
|
|
27
|
-
if old_field.type != new_field.type
|
27
|
+
if old_field.type.graphql_definition != new_field.type.graphql_definition
|
28
28
|
changes << Changes::FieldTypeChanged.new(new_type, old_field, new_field)
|
29
29
|
end
|
30
30
|
|
@@ -21,7 +21,7 @@ module GraphQL
|
|
21
21
|
changes << Changes::InputFieldDefaultChanged.new(old_type, old_field, new_field)
|
22
22
|
end
|
23
23
|
|
24
|
-
if old_field.type != new_field.type
|
24
|
+
if old_field.type.graphql_definition != new_field.type.graphql_definition
|
25
25
|
changes << Changes::InputFieldTypeChanged.new(old_type, old_field, new_field)
|
26
26
|
end
|
27
27
|
|
@@ -3,8 +3,8 @@ module GraphQL
|
|
3
3
|
module Diff
|
4
4
|
class ObjectType
|
5
5
|
def initialize(old_type, new_type)
|
6
|
-
@old_type = old_type
|
7
|
-
@new_type = new_type
|
6
|
+
@old_type = old_type.graphql_definition
|
7
|
+
@new_type = new_type.graphql_definition
|
8
8
|
|
9
9
|
@old_fields = old_type.fields
|
10
10
|
@new_fields = new_type.fields
|
@@ -40,15 +40,19 @@ module GraphQL
|
|
40
40
|
)
|
41
41
|
|
42
42
|
def interface_removals
|
43
|
-
removed = old_interfaces
|
43
|
+
removed = filter_interfaces(old_interfaces, new_interfaces)
|
44
44
|
removed.map { |iface| Changes::ObjectTypeInterfaceRemoved.new(iface, old_type) }
|
45
45
|
end
|
46
46
|
|
47
47
|
def interface_additions
|
48
|
-
added = new_interfaces
|
48
|
+
added = filter_interfaces(new_interfaces, old_interfaces)
|
49
49
|
added.map { |iface| Changes::ObjectTypeInterfaceAdded.new(iface, new_type) }
|
50
50
|
end
|
51
51
|
|
52
|
+
def filter_interfaces(interfaces, excluded_interfaces)
|
53
|
+
interfaces.select { |interface| !excluded_interfaces.map(&:graphql_definition).include?(interface.graphql_definition) }
|
54
|
+
end
|
55
|
+
|
52
56
|
def field_removals
|
53
57
|
removed = old_fields.values.select { |field| !new_fields[field.name] }
|
54
58
|
removed.map { |field| Changes::FieldRemoved.new(old_type, field) }
|
@@ -40,7 +40,7 @@ module GraphQL
|
|
40
40
|
if old_type.kind != new_type.kind
|
41
41
|
changes << Changes::TypeKindChanged.new(old_type, new_type)
|
42
42
|
else
|
43
|
-
case old_type
|
43
|
+
case old_type.graphql_definition
|
44
44
|
when GraphQL::EnumType
|
45
45
|
changes += Diff::Enum.new(old_type, new_type).diff
|
46
46
|
when GraphQL::UnionType
|
@@ -64,15 +64,15 @@ module GraphQL
|
|
64
64
|
def changes_in_schema
|
65
65
|
changes = []
|
66
66
|
|
67
|
-
if old_schema.query != new_schema.query
|
67
|
+
if old_schema.query&.to_graphql != new_schema.query&.to_graphql
|
68
68
|
changes << Changes::SchemaQueryTypeChanged.new(old_schema, new_schema)
|
69
69
|
end
|
70
70
|
|
71
|
-
if old_schema.mutation != new_schema.mutation
|
71
|
+
if old_schema.mutation&.to_graphql != new_schema.mutation&.to_graphql
|
72
72
|
changes << Changes::SchemaMutationTypeChanged.new(old_schema, new_schema)
|
73
73
|
end
|
74
74
|
|
75
|
-
if old_schema.subscription != new_schema.subscription
|
75
|
+
if old_schema.subscription&.to_graphql != new_schema.subscription&.to_graphql
|
76
76
|
changes << Changes::SchemaSubscriptionTypeChanged.new(old_schema, new_schema)
|
77
77
|
end
|
78
78
|
|
@@ -26,11 +26,15 @@ module GraphQL
|
|
26
26
|
attr_reader :old_type, :new_type, :old_possible_types, :new_possible_types
|
27
27
|
|
28
28
|
def removed_possible_types
|
29
|
-
old_possible_types
|
29
|
+
filter_types(old_possible_types, new_possible_types)
|
30
30
|
end
|
31
31
|
|
32
32
|
def added_possible_types
|
33
|
-
new_possible_types
|
33
|
+
filter_types(new_possible_types, old_possible_types)
|
34
|
+
end
|
35
|
+
|
36
|
+
def filter_types(types, exclude_types)
|
37
|
+
types.select { |type| !exclude_types.map(&:graphql_definition).include?(type.graphql_definition) }
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-schema_comparator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-Andre Giroux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.10'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|