hq-graphql 2.1.9 → 2.1.10

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
  SHA256:
3
- metadata.gz: 981f1e51c20c41befde482f0ab312887f597727265508b2f8b4290420c91e2e1
4
- data.tar.gz: 3038b46301c4b612a99988ba7fe9aa66aadc401a7a8a4ea8a959b3e8c23e8743
3
+ metadata.gz: 9dd3d2f47411b616e76f20e118b4a959af58a13223b5d8e758bb35919c5b2b02
4
+ data.tar.gz: 781c03507b71570f5e9c6b9dc34117f34649097d1e4026701fd740c78209acad
5
5
  SHA512:
6
- metadata.gz: 30e473198ed03eaf14a9a4c9730c2a5816f5914dc745ef1fe0acc0b8e16f6a0b9b1f80bb2861fcb7bec16a5a0860bca1197b54892450686e545ef04f4f141611
7
- data.tar.gz: e4b0b57d5674e48fe75ec61de48cf484425b504500b1e201322650211856de5557da6353f95907d77bb41bf0b41ef52c0434349d805dc8b29fec27eb0182c57c
6
+ metadata.gz: f5be4f443b74567f67e082cec1ae52d83f3adb0b2ae7964afb2f49e74467ed0185c04f34f363f3a0bb153e97bf90c7d8eff2e831d9d137cb1ca7c669b9af2ac8
7
+ data.tar.gz: aecd6fcaf3f269d0bf2d7504cdebf4e022fd5e4c670d9ad5153f1658d127ba12ca0661711d7cfd1863615d0b94b7ab2098dd5d8e22a8fbb7271a41f5f5a89da5
@@ -124,6 +124,10 @@ module HQ
124
124
  @removed_associations ||= []
125
125
  end
126
126
 
127
+ def camelize(name)
128
+ name.to_s.camelize(:lower)
129
+ end
130
+
127
131
  def is_enum?(association)
128
132
  ::HQ::GraphQL.enums.include?(association.klass)
129
133
  end
@@ -67,6 +67,7 @@ module HQ
67
67
  is_enum = is_enum?(association)
68
68
  input_or_type = is_enum ? ::HQ::GraphQL::Types[association.klass] : ::HQ::GraphQL::Inputs[association.klass]
69
69
  name = association.name
70
+ return if argument_exists?(name)
70
71
 
71
72
  case association.macro
72
73
  when :has_many
@@ -87,7 +88,13 @@ module HQ
87
88
  end
88
89
 
89
90
  def argument_from_column(column)
90
- argument column.name, ::HQ::GraphQL::Types.type_from_column(column), required: false
91
+ name = column.name
92
+ return if argument_exists?(name)
93
+ argument name, ::HQ::GraphQL::Types.type_from_column(column), required: false
94
+ end
95
+
96
+ def argument_exists?(name)
97
+ !!arguments[camelize(name)]
91
98
  end
92
99
  end
93
100
  end
@@ -65,7 +65,7 @@ module HQ
65
65
  def field_from_association(association, auto_nil:, internal_association: false, &block)
66
66
  association_klass = association.klass
67
67
  name = association.name.to_s
68
- return if fields[name]
68
+ return if field_exists?(name)
69
69
 
70
70
  klass = model_klass
71
71
  type = Types[association_klass]
@@ -95,11 +95,15 @@ module HQ
95
95
 
96
96
  def field_from_column(column, auto_nil:)
97
97
  name = column.name
98
- return if fields[name]
98
+ return if field_exists?(name)
99
99
 
100
100
  field name, Types.type_from_column(column), null: !auto_nil || column.null
101
101
  end
102
102
 
103
+ def field_exists?(name)
104
+ !!fields[camelize(name)]
105
+ end
106
+
103
107
  def association_required?(association)
104
108
  !association.options[:optional] || has_presence_validation?(association)
105
109
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module HQ
4
4
  module GraphQL
5
- VERSION = "2.1.9"
5
+ VERSION = "2.1.10"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hq-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.9
4
+ version: 2.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Jones
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-11 00:00:00.000000000 Z
11
+ date: 2020-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails