graphiti_gql 0.2.9 → 0.2.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: 544e1209bfdf6e48d70a76490edec46bc04639d75d91bae2a35ab95ea8fb4530
4
- data.tar.gz: '0688127e3a2ab48d4bdd3f7f70a4efd544dd4bb4c9a952c0c4302ede86c1c24a'
3
+ metadata.gz: c8778ea5c62ff7c2eb9f32d674ece0a9b0c87ee30f57417fe02e61e2ed8c75e8
4
+ data.tar.gz: a80c2443b2c13cbd0d36d7160f8b2e3bde75ac97d87b4d58278440fab0e8426e
5
5
  SHA512:
6
- metadata.gz: 67b52a3241814fd821cf23982ed55e02c1e0e171d41c5c3bb54cdcd53e04ea28a13fab327d86a5756dee7499f88d163316b93cfebf730a4681ab54a627693f9b
7
- data.tar.gz: ce6ab0de40b33e0750f4eb33c63249c91a6b478503cce6fc0cc92081b18190346a9e4190027b940020f69459c40094a963b3a0d1e440e63ed4a2f47e1bd904cd
6
+ metadata.gz: cad6708ae17b85ec5010245978d2f1dae7077fbbcc7d1303241ac1798a110b58638e68ab4d66ffab73a285f5a6ea5d8bc92b2cc347e2bd49c87d3b74fe96dcd7
7
+ data.tar.gz: '09d2dc8810af44fca96160ab941cca950dd35779b7659b30882cd3e2ec3a40a9551055c5cc585ff6c9514a3c3952491c986225f8ede57e915dc64af0901df739'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphiti_gql (0.2.8)
4
+ graphiti_gql (0.2.9)
5
5
  graphiti (~> 1.3.9)
6
6
  graphql (~> 2.0)
7
7
  graphql-batch (~> 0.5)
@@ -118,7 +118,7 @@ module GraphitiGql
118
118
 
119
119
  name = Schema.registry.key_for(@resource)
120
120
  sortvar = "$sort: [#{name}Sort!]," if @resource.sorts.any?
121
- filter_bang = "!" if @resource.filters.values.any? { |f| f[:required] }
121
+ filter_bang = "!" if @resource.grouped_filters.any? || @resource.filters.values.any? { |f| f[:required] }
122
122
  filtervar = "$filter: #{name}Filter#{filter_bang}," if @resource.filters.any?
123
123
 
124
124
  if !(fields = @params[:fields])
@@ -36,6 +36,7 @@ module GraphitiGql
36
36
  value
37
37
  end
38
38
  }
39
+ required = true if @resource.grouped_filters.any? && !@sideload
39
40
  field.argument :filter, filter_type, required: required
40
41
  end
41
42
 
@@ -46,11 +47,18 @@ module GraphitiGql
46
47
  end
47
48
  klass = Class.new(GraphQL::Schema::InputObject)
48
49
  klass.graphql_name type_name
50
+ required_via_group = []
51
+ if (group = @resource.grouped_filters).present?
52
+ if group[:required] == :all
53
+ required_via_group = group[:names].map(&:to_sym)
54
+ end
55
+ end
49
56
  @resource.filters.each_pair do |name, config|
50
57
  attr_type = generate_filter_attribute_type(type_name, name, config)
58
+ required = !!config[:required] || required_via_group.include?(name)
51
59
  klass.argument name.to_s.camelize(:lower),
52
60
  attr_type,
53
- required: !!config[:required]
61
+ required: required
54
62
  end
55
63
  registry[type_name] = { type: klass }
56
64
  klass
@@ -1,3 +1,3 @@
1
1
  module GraphitiGql
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti_gql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-11 00:00:00.000000000 Z
11
+ date: 2022-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '7.0'
111
- description:
111
+ description:
112
112
  email:
113
113
  - richmolj@gmail.com
114
114
  executables: []
@@ -170,7 +170,7 @@ licenses:
170
170
  - MIT
171
171
  metadata:
172
172
  homepage_uri: https://www.graphiti.dev
173
- post_install_message:
173
+ post_install_message:
174
174
  rdoc_options: []
175
175
  require_paths:
176
176
  - lib
@@ -185,8 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  requirements: []
188
- rubygems_version: 3.0.3.1
189
- signing_key:
188
+ rubygems_version: 3.3.7
189
+ signing_key:
190
190
  specification_version: 4
191
191
  summary: GraphQL support for Graphiti
192
192
  test_files: []