graphql-schema_comparator 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0706d1728e914ffaf9626d34a88bef2865938415
4
- data.tar.gz: 1e8c4c1fdd0de7a0fa5458ab0f7505c85bfa4335
3
+ metadata.gz: 3b2c5111538092113b88552e2d85930eea51b4c0
4
+ data.tar.gz: 3a3b4d43916961515caa915c51e0c0b0370c1395
5
5
  SHA512:
6
- metadata.gz: 82a98d283e5a9efcb12205be3654936614b858a3813f93134343c32672d5691abac3411875cd18b6ef0f841e91a35fa620ceddc4a2500f51be1af0861c9d82d5
7
- data.tar.gz: c78a997c5280e781ad000e1434d85ba783756b1554423572cf7cbb4476f6d776ab7df4e5781183e603ccd242c770bcca1320e1179b88db2fee27f106efc4cf8a
6
+ metadata.gz: 00c6e2702e8bb9c1f34b1d9a777a3b63cc0cb6f56aa78f76bf14c04aee0997e6e690f79de956d46da31be9298a98ff72413d5cd77f18b514cd0b6b8a02021f76
7
+ data.tar.gz: b74179eb8941cf2985f9dda75219b28b001e4c771db5db3d49e380cc98bc94c625d720dd7bf4cb88ddef6e51672b0a50b136b92da3e6dbfc6af3c13874e8c65f
data/CHANGELOG.md CHANGED
@@ -1,14 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0 (Feb 28th 2018)
4
+
5
+ ### New Features
6
+
7
+ - Add `#path` which returns a dot-delimited path to the affected schema member. (#15)
8
+
3
9
  ## 0.5.1 (Feb 15th 2018)
4
10
 
5
- ## Bug Fix
11
+ ### Bug Fix
6
12
 
7
13
  - Return a better message when adding a default value, if this one was nil before.
8
14
 
9
15
  ## 0.5.0 (Dec 2 2017)
10
16
 
11
- ## New Features
17
+ ### New Features
12
18
 
13
19
  - `AbstractChange#criticality` now returns a criticality object which
14
20
  has a level (non_breaking, dangerous, breaking) and a reason
@@ -19,14 +25,14 @@
19
25
 
20
26
  - New CLI `schema_comparator` which includes `dangerous_changes`
21
27
 
22
- ## Breaking Changes
28
+ ### Breaking Changes
23
29
 
24
30
  - Some changes have been recategorized as dangerous
25
31
  - Some type changes now return breaking or non-breaking depending on the type kind
26
32
 
27
33
  ## 0.4.0 (Nov 27 2017)
28
34
 
29
- ## Breaking Changes
35
+ ### Breaking Changes
30
36
 
31
37
  - Argument and InputValue type changes are considered non
32
38
  breaking if type goes from Null => Non-Null
@@ -12,7 +12,7 @@ module GraphQL
12
12
  raise NotImplementedError
13
13
  end
14
14
 
15
- # @return [Boolean] If the change is breaking or not
15
+ # @return [Boolean] If the change is breaking or not
16
16
  def breaking?
17
17
  criticality.breaking?
18
18
  end
@@ -31,6 +31,11 @@ module GraphQL
31
31
  def criticality
32
32
  raise NotImplementedError
33
33
  end
34
+
35
+ # @return [String] Dot-delimited path to the affected schema member.
36
+ def path
37
+ raise NotImplementedError
38
+ end
34
39
  end
35
40
 
36
41
  # Mostly breaking changes
@@ -44,7 +49,11 @@ module GraphQL
44
49
  end
45
50
 
46
51
  def message
47
- "`#{removed_type.name}` was removed"
52
+ "Type `#{removed_type.name}` was removed"
53
+ end
54
+
55
+ def path
56
+ removed_type.name
48
57
  end
49
58
  end
50
59
 
@@ -57,7 +66,11 @@ module GraphQL
57
66
  end
58
67
 
59
68
  def message
60
- "`#{directive.name}` was removed"
69
+ "Directive `#{directive.name}` was removed"
70
+ end
71
+
72
+ def path
73
+ "@#{directive.name}"
61
74
  end
62
75
  end
63
76
 
@@ -73,6 +86,10 @@ module GraphQL
73
86
  def message
74
87
  "`#{old_type.name}` kind changed from `#{old_type.kind}` to `#{new_type.kind}`"
75
88
  end
89
+
90
+ def path
91
+ old_type.name
92
+ end
76
93
  end
77
94
 
78
95
  class EnumValueRemoved < AbstractChange
@@ -87,6 +104,10 @@ module GraphQL
87
104
  def message
88
105
  "Enum value `#{enum_value.name}` was removed from enum `#{enum_type.name}`"
89
106
  end
107
+
108
+ def path
109
+ [enum_type.name, enum_value.name].join('.')
110
+ end
90
111
  end
91
112
 
92
113
  class UnionMemberRemoved < AbstractChange
@@ -101,6 +122,10 @@ module GraphQL
101
122
  def message
102
123
  "Union member `#{union_member.name}` was removed from Union type `#{union_type.name}`"
103
124
  end
125
+
126
+ def path
127
+ union_type.name
128
+ end
104
129
  end
105
130
 
106
131
  class InputFieldRemoved < AbstractChange
@@ -115,6 +140,10 @@ module GraphQL
115
140
  def message
116
141
  "Input field `#{field.name}` was removed from input object type `#{input_object_type.name}`"
117
142
  end
143
+
144
+ def path
145
+ [input_object_type.name, field.name].join('.')
146
+ end
118
147
  end
119
148
 
120
149
  class FieldArgumentRemoved < AbstractChange
@@ -130,6 +159,10 @@ module GraphQL
130
159
  def message
131
160
  "Argument `#{argument.name}: #{argument.type}` was removed from field `#{object_type.name}.#{field.name}`"
132
161
  end
162
+
163
+ def path
164
+ [object_type.name, field.name, argument.name].join('.')
165
+ end
133
166
  end
134
167
 
135
168
  class DirectiveArgumentRemoved < AbstractChange
@@ -144,6 +177,10 @@ module GraphQL
144
177
  def message
145
178
  "Argument `#{argument.name}` was removed from directive `#{directive.name}`"
146
179
  end
180
+
181
+ def path
182
+ ["@#{directive.name}", argument.name].join('.')
183
+ end
147
184
  end
148
185
 
149
186
  class SchemaQueryTypeChanged < AbstractChange
@@ -158,6 +195,10 @@ module GraphQL
158
195
  def message
159
196
  "Schema query root has changed from `#{old_schema.query.name}` to `#{new_schema.query.name}`"
160
197
  end
198
+
199
+ def path
200
+ # TODO
201
+ end
161
202
  end
162
203
 
163
204
  class FieldRemoved < AbstractChange
@@ -172,6 +213,10 @@ module GraphQL
172
213
  def message
173
214
  "Field `#{field.name}` was removed from object type `#{object_type.name}`"
174
215
  end
216
+
217
+ def path
218
+ [object_type.name, field.name].join('.')
219
+ end
175
220
  end
176
221
 
177
222
  class DirectiveLocationRemoved < AbstractChange
@@ -186,6 +231,10 @@ module GraphQL
186
231
  def message
187
232
  "Location `#{location}` was removed from directive `#{directive.name}`"
188
233
  end
234
+
235
+ def path
236
+ "@#{directive.name}"
237
+ end
189
238
  end
190
239
 
191
240
  class ObjectTypeInterfaceRemoved < AbstractChange
@@ -200,6 +249,10 @@ module GraphQL
200
249
  def message
201
250
  "`#{object_type.name}` object type no longer implements `#{interface.name}` interface"
202
251
  end
252
+
253
+ def path
254
+ object_type.name
255
+ end
203
256
  end
204
257
 
205
258
  class FieldTypeChanged < AbstractChange
@@ -224,6 +277,10 @@ module GraphQL
224
277
  Changes::Criticality.breaking
225
278
  end
226
279
  end
280
+
281
+ def path
282
+ [type.name, old_field.name].join('.')
283
+ end
227
284
  end
228
285
 
229
286
  class InputFieldTypeChanged < AbstractChange
@@ -248,6 +305,10 @@ module GraphQL
248
305
  def message
249
306
  "Input field `#{input_type}.#{old_input_field.name}` changed type from `#{old_input_field.type}` to `#{new_input_field.type}`"
250
307
  end
308
+
309
+ def path
310
+ [input_type.name, old_input_field.name].join('.')
311
+ end
251
312
  end
252
313
 
253
314
  class FieldArgumentTypeChanged < AbstractChange
@@ -274,6 +335,10 @@ module GraphQL
274
335
  "Type for argument `#{new_argument.name}` on field `#{type.name}.#{field.name}` changed"\
275
336
  " from `#{old_argument.type}` to `#{new_argument.type}`"
276
337
  end
338
+
339
+ def path
340
+ [type.name, field.name, old_argument.name].join('.')
341
+ end
277
342
  end
278
343
 
279
344
  class DirectiveArgumentTypeChanged < AbstractChange
@@ -299,6 +364,10 @@ module GraphQL
299
364
  "Type for argument `#{new_argument.name}` on directive `#{directive.name}` changed"\
300
365
  " from `#{old_argument.type}` to `#{new_argument.type}`"
301
366
  end
367
+
368
+ def path
369
+ ["@#{directive.name}", old_argument.name].join('.')
370
+ end
302
371
  end
303
372
 
304
373
  class SchemaMutationTypeChanged < AbstractChange
@@ -313,6 +382,10 @@ module GraphQL
313
382
  def message
314
383
  "Schema mutation root has changed from `#{old_schema.mutation}` to `#{new_schema.mutation}`"
315
384
  end
385
+
386
+ def path
387
+ # TODO
388
+ end
316
389
  end
317
390
 
318
391
  class SchemaSubscriptionTypeChanged < AbstractChange
@@ -327,6 +400,10 @@ module GraphQL
327
400
  def message
328
401
  "Schema subscription type has changed from `#{old_schema.subscription}` to `#{new_schema.subscription}`"
329
402
  end
403
+
404
+ def path
405
+ # TODO
406
+ end
330
407
  end
331
408
 
332
409
  # Dangerous Changes
@@ -353,6 +430,10 @@ module GraphQL
353
430
  " from `#{old_argument.default_value}` to `#{new_argument.default_value}`"
354
431
  end
355
432
  end
433
+
434
+ def path
435
+ [type.name, field.name, old_argument.name].join('.')
436
+ end
356
437
  end
357
438
 
358
439
  class InputFieldDefaultChanged < AbstractChange
@@ -372,6 +453,10 @@ module GraphQL
372
453
  "Input field `#{input_type.name}.#{old_field.name}` default changed"\
373
454
  " from `#{old_field.default_value}` to `#{new_field.default_value}`"
374
455
  end
456
+
457
+ def path
458
+ [input_type.name, old_field.name].join(".")
459
+ end
375
460
  end
376
461
 
377
462
  class DirectiveArgumentDefaultChanged < AbstractChange
@@ -391,6 +476,10 @@ module GraphQL
391
476
  "Default value for argument `#{new_argument.name}` on directive `#{directive.name}` changed"\
392
477
  " from `#{old_argument.default_value}` to `#{new_argument.default_value}`"
393
478
  end
479
+
480
+ def path
481
+ ["@#{directive.name}", new_argument.name].join(".")
482
+ end
394
483
  end
395
484
 
396
485
  class EnumValueAdded < AbstractChange
@@ -408,6 +497,10 @@ module GraphQL
408
497
  def message
409
498
  "Enum value `#{enum_value.name}` was added to enum `#{enum_type.name}`"
410
499
  end
500
+
501
+ def path
502
+ [enum_type.name, enum_value.name].join(".")
503
+ end
411
504
  end
412
505
 
413
506
  class UnionMemberAdded < AbstractChange
@@ -425,6 +518,10 @@ module GraphQL
425
518
  def message
426
519
  "Union member `#{union_member.name}` was added to Union type `#{union_type.name}`"
427
520
  end
521
+
522
+ def path
523
+ union_type.name
524
+ end
428
525
  end
429
526
 
430
527
  class ObjectTypeInterfaceAdded < AbstractChange
@@ -442,6 +539,10 @@ module GraphQL
442
539
  def message
443
540
  "`#{object_type.name}` object implements `#{interface.name}` interface"
444
541
  end
542
+
543
+ def path
544
+ object_type.name
545
+ end
445
546
  end
446
547
 
447
548
  # Mostly Non-Breaking Changes
@@ -463,6 +564,10 @@ module GraphQL
463
564
  def message
464
565
  "Input field `#{field.name}` was added to input object type `#{input_object_type.name}`"
465
566
  end
567
+
568
+ def path
569
+ [input_object_type.name, field.name].join(".")
570
+ end
466
571
  end
467
572
 
468
573
  class FieldArgumentAdded < AbstractChange
@@ -483,6 +588,10 @@ module GraphQL
483
588
  def message
484
589
  "Argument `#{argument.name}: #{argument.type}` added to field `#{type.name}.#{field.name}`"
485
590
  end
591
+
592
+ def path
593
+ [type.name, field.name, argument.name].join(".")
594
+ end
486
595
  end
487
596
 
488
597
  class TypeAdded < AbstractChange
@@ -496,6 +605,10 @@ module GraphQL
496
605
  def message
497
606
  "Type `#{type.name}` was added"
498
607
  end
608
+
609
+ def path
610
+ type.name
611
+ end
499
612
  end
500
613
 
501
614
  class DirectiveAdded < AbstractChange
@@ -509,6 +622,10 @@ module GraphQL
509
622
  def message
510
623
  "Directive `#{directive.name}` was added"
511
624
  end
625
+
626
+ def path
627
+ "@#{directive.name}"
628
+ end
512
629
  end
513
630
 
514
631
  class TypeDescriptionChanged < AbstractChange
@@ -523,6 +640,10 @@ module GraphQL
523
640
  def message
524
641
  "Description `#{old_type.description}` on type `#{old_type.name}` has changed to `#{new_type.description}`"
525
642
  end
643
+
644
+ def path
645
+ old_type.name
646
+ end
526
647
  end
527
648
 
528
649
  class EnumValueDescriptionChanged < AbstractChange
@@ -539,6 +660,10 @@ module GraphQL
539
660
  "Description for enum value `#{enum.name}.#{new_enum_value.name}` changed from " \
540
661
  "`#{old_enum_value.description}` to `#{new_enum_value.description}`"
541
662
  end
663
+
664
+ def path
665
+ [enum.name, old_enum_value.name].join(".")
666
+ end
542
667
  end
543
668
 
544
669
  class EnumValueDeprecated < AbstractChange
@@ -560,6 +685,10 @@ module GraphQL
560
685
  " `#{new_enum_value.deprecation_reason}`"
561
686
  end
562
687
  end
688
+
689
+ def path
690
+ [enum.name, old_enum_value.name].join(".")
691
+ end
563
692
  end
564
693
 
565
694
  class InputFieldDescriptionChanged < AbstractChange
@@ -576,6 +705,10 @@ module GraphQL
576
705
  "Input field `#{input_type.name}.#{old_field.name}` description changed"\
577
706
  " from `#{old_field.description}` to `#{new_field.description}`"
578
707
  end
708
+
709
+ def path
710
+ [input_type.name, old_field.name].join(".")
711
+ end
579
712
  end
580
713
 
581
714
  class DirectiveDescriptionChanged < AbstractChange
@@ -591,6 +724,10 @@ module GraphQL
591
724
  "Directive `#{new_directive.name}` description changed"\
592
725
  " from `#{old_directive.description}` to `#{new_directive.description}`"
593
726
  end
727
+
728
+ def path
729
+ "@#{old_directive.name}"
730
+ end
594
731
  end
595
732
 
596
733
  class FieldDescriptionChanged < AbstractChange
@@ -607,6 +744,10 @@ module GraphQL
607
744
  "Field `#{type.name}.#{old_field.name}` description changed"\
608
745
  " from `#{old_field.description}` to `#{new_field.description}`"
609
746
  end
747
+
748
+ def path
749
+ [type.name, old_field.name].join(".")
750
+ end
610
751
  end
611
752
 
612
753
  class FieldArgumentDescriptionChanged < AbstractChange
@@ -624,6 +765,10 @@ module GraphQL
624
765
  "Description for argument `#{new_argument.name}` on field `#{type.name}.#{field.name}` changed"\
625
766
  " from `#{old_argument.description}` to `#{new_argument.description}`"
626
767
  end
768
+
769
+ def path
770
+ [type.name, field.name, old_argument.name].join(".")
771
+ end
627
772
  end
628
773
 
629
774
  class DirectiveArgumentDescriptionChanged < AbstractChange
@@ -640,6 +785,10 @@ module GraphQL
640
785
  "Description for argument `#{new_argument.name}` on directive `#{directive.name}` changed"\
641
786
  " from `#{old_argument.description}` to `#{new_argument.description}`"
642
787
  end
788
+
789
+ def path
790
+ ["@#{directive.name}", old_argument.name].join(".")
791
+ end
643
792
  end
644
793
 
645
794
  class FieldDeprecationChanged < AbstractChange
@@ -656,6 +805,10 @@ module GraphQL
656
805
  "Deprecation reason on field `#{type.name}.#{new_field.name}` has changed "\
657
806
  "from `#{old_field.deprecation_reason}` to `#{new_field.deprecation_reason}`"
658
807
  end
808
+
809
+ def path
810
+ [type.name, old_field.name].join(".")
811
+ end
659
812
  end
660
813
 
661
814
  class FieldAdded < AbstractChange
@@ -671,6 +824,9 @@ module GraphQL
671
824
  "Field `#{field.name}` was added to object type `#{object_type.name}`"
672
825
  end
673
826
 
827
+ def path
828
+ [object_type.name, field.name].join(".")
829
+ end
674
830
  end
675
831
 
676
832
  class DirectiveLocationAdded < AbstractChange
@@ -685,6 +841,10 @@ module GraphQL
685
841
  def message
686
842
  "Location `#{location}` was added to directive `#{directive.name}`"
687
843
  end
844
+
845
+ def path
846
+ "@#{directive.name}"
847
+ end
688
848
  end
689
849
 
690
850
  # TODO
@@ -49,8 +49,8 @@ module GraphQL
49
49
  def each_common_argument(&block)
50
50
  intersection = old_arguments.keys & new_arguments.keys
51
51
  intersection.each do |common_arg|
52
- old_arg = new_directive.arguments[common_arg]
53
- new_arg = old_directive.arguments[common_arg]
52
+ old_arg = old_directive.arguments[common_arg]
53
+ new_arg = new_directive.arguments[common_arg]
54
54
 
55
55
  block.call(old_arg, new_arg)
56
56
  end
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module SchemaComparator
3
- VERSION = "0.5.1"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  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.5.1
4
+ version: 0.6.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: 2018-02-15 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql