graphql-constraint-directive 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba3f526ee2124471f6dfc59db75677018871fb2166a056def33c4436ac77bf56
4
- data.tar.gz: bcf163565e80cbc79b26ca429d540c7b0949281fe7fe2b86b5af3136b0b71932
3
+ metadata.gz: 46bdc345b3060ac6b9c965350a9c5f9928246bdeb1805975228f9f42f69f87e4
4
+ data.tar.gz: af01415fd405937df061bd4dcc47a2f8a97c34f7d9b50de4e6446426940dc52b
5
5
  SHA512:
6
- metadata.gz: 917131726cb5381b676bd09c4c8e30a87a64b6bbc7674304396fd7da14979a7c6ee5243516d2a757f2bbd16809925c73eb083f027e9764f607f8666ab448826d
7
- data.tar.gz: 4f91c444e0013e31250d3cb431f745b9fc3e947063c706739ab86915a19009fcd3b459e417bf4ba4df6de3f7a5a3ba439a81b64f58354cfacd4c981530089a39
6
+ metadata.gz: 6955147fb378004d1887725a8872b66b8a6fbbb94e7d45c0c4b948c2a3e58763299690b1367572b05f189b6a35f3dc6971e58b831337a2d65324ce91b0ecf690
7
+ data.tar.gz: 453cf6b76b66e6b4fa2830f39cade3186737177b09102fa61a3ec235af8be098af4dfdd5a3baf6e25637afa7e84ae39999f2fb3cf3a43d2ff97ce9d19088c0ec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql-constraint-directive (0.1.1)
4
+ graphql-constraint-directive (0.1.2)
5
5
  graphql (~> 2.0, < 3)
6
6
 
7
7
  GEM
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "graphql"
4
+ require "byebug"
4
5
 
5
6
  module GraphQL
6
7
  module Constraint
@@ -29,7 +30,7 @@ module GraphQL
29
30
  def length_config
30
31
  filtered_args = arguments.keyword_arguments.filter { |key, _| LENGTH.key?(key) }
31
32
 
32
- if owner.type != GraphQL::Types::String
33
+ if owner_type != GraphQL::Types::String
33
34
  raise ArgumentError, <<~MD
34
35
  #{filtered_args.keys.join(", ")} in @constraint can't be attached to #{owner.graphql_name} because it has to be a String type.
35
36
  MD
@@ -37,6 +38,10 @@ module GraphQL
37
38
 
38
39
  filtered_args.transform_keys { |key| LENGTH[key] }
39
40
  end
41
+
42
+ def owner_type
43
+ owner.type.non_null? ? owner.type.of_type : owner.type
44
+ end
40
45
  end
41
46
  end
42
47
  end
@@ -3,7 +3,7 @@
3
3
  module GraphQL
4
4
  module Constraint
5
5
  module Directive
6
- VERSION = "0.1.1"
6
+ VERSION = "0.1.2"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-constraint-directive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MH4GF