graphql-schema_comparator 0.3.2 → 0.4.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/CHANGELOG.md +7 -0
- data/lib/graphql/schema_comparator/changes.rb +21 -2
- data/lib/graphql/schema_comparator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e193c10ab21868ab4bf6fd6f3159b4d3e4a67525
|
4
|
+
data.tar.gz: 9603fd58643f3a1dabecb23ff543a646657b1f3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bced670ccc797b2222231e60d930d167e1856d820722c0c4946c45fe2d84c96fcdd50f9e91089a83a82adc9f9dee212aa6636c810a48e57745ece7b7a1d48c50
|
7
|
+
data.tar.gz: ea0916f65eb4de48038077dff40add62c7fa9d5581293d1618c4b045086545b465e13aecfb0c0390f1147496d47bcee7c5ef10c09ec0c5f5cf2f4503bb04bbb8
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
module GraphQL
|
2
2
|
module SchemaComparator
|
3
3
|
module Changes
|
4
|
+
module SafeTypeChange
|
5
|
+
def safe_change?(old_type, new_type)
|
6
|
+
if !old_type.kind.wraps? && !new_type.kind.wraps?
|
7
|
+
old_type == new_type
|
8
|
+
elsif old_type.kind.list? && new_type.kind.list?
|
9
|
+
safe_change?(old_type.of_type, new_type.of_type)
|
10
|
+
elsif old_type.kind.non_null?
|
11
|
+
of_type = new_type.kind.non_null? ? new_type.of_type : new_type
|
12
|
+
safe_change?(old_type.of_type, of_type)
|
13
|
+
else
|
14
|
+
false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
4
19
|
class AbstractChange
|
5
20
|
def message
|
6
21
|
raise NotImplementedError
|
@@ -793,13 +808,15 @@ module GraphQL
|
|
793
808
|
end
|
794
809
|
|
795
810
|
class InputFieldTypeChanged < AbstractChange
|
811
|
+
include SafeTypeChange
|
812
|
+
|
796
813
|
attr_reader :input_type, :old_input_field, :new_input_field
|
797
814
|
|
798
815
|
def initialize(input_type, old_input_field, new_input_field)
|
799
816
|
@input_type = input_type
|
800
817
|
@old_input_field = old_input_field
|
801
818
|
@new_input_field = new_input_field
|
802
|
-
@breaking =
|
819
|
+
@breaking = !safe_change?(old_input_field.type, new_input_field.type)
|
803
820
|
end
|
804
821
|
|
805
822
|
def message
|
@@ -812,6 +829,8 @@ module GraphQL
|
|
812
829
|
end
|
813
830
|
|
814
831
|
class FieldArgumentTypeChanged < AbstractChange
|
832
|
+
include SafeTypeChange
|
833
|
+
|
815
834
|
attr_reader :type, :field, :old_argument, :new_argument
|
816
835
|
|
817
836
|
def initialize(type, field, old_argument, new_argument)
|
@@ -819,7 +838,7 @@ module GraphQL
|
|
819
838
|
@field = field
|
820
839
|
@old_argument = old_argument
|
821
840
|
@new_argument = new_argument
|
822
|
-
@breaking =
|
841
|
+
@breaking = !safe_change?(old_argument.type, new_argument.type)
|
823
842
|
end
|
824
843
|
|
825
844
|
def message
|
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: 0.4.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: 2017-11-
|
11
|
+
date: 2017-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|