graphiform 0.2.3 → 0.2.8

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: e55cfe2745a2343ff704c8fa0d6daaf8fde9a24c0d91e78fd938d0c143f74f6e
4
- data.tar.gz: f4245107d1b61418d0a2e1995f845a42d56f8e45a33efa6cfd57f039795c587a
3
+ metadata.gz: 432786d8d7975e7f6e64f28d1bc59d0755ce92235a20316464443a919269ae0c
4
+ data.tar.gz: cd9e5a854f67606b057fb6e98d6a5b43958aa8d6434d8178e6bb85b568925b5e
5
5
  SHA512:
6
- metadata.gz: 8e09ad27673bd942cf6a761a090451f4dab2ebe7a09dfc509fba0311ca412b2ddbdb39cd83dddc237a19fbe2c001b227244ffac601c9301e41d18468f55bd5bd
7
- data.tar.gz: beb387c2994ec3e01c16441e358e6e49c3cb14c6b47e3a5ee2ec103fce48b7c55b57350bb3d21e11b021bd6210852af51f9c135ccb9dd7074395cdd8b1e5b4fb
6
+ metadata.gz: 5ab126d3a8225ac6142b1e6088939d8e30dea963b9b1413ada93261e79a9324153e6307764fe11c7ff76180015ce359bee435c33d0ee950b213713bd71e986e6
7
+ data.tar.gz: 60e32edb27e043e3440d1b5c97128a7e7873a1df2df60386c86253653b7842b85f6f6300bb3b5b1ded0d02822db9af66f618ecd110b0fa22c13a43fb96f83b0e
data/lib/graphiform.rb CHANGED
@@ -5,6 +5,7 @@ require 'graphiform/skeleton'
5
5
  require 'graphiform/active_record_helpers'
6
6
  require 'graphiform/core'
7
7
  require 'graphiform/fields'
8
+ require 'graphiform/sort_enum'
8
9
 
9
10
  module Graphiform
10
11
  def self.included(base)
@@ -136,7 +136,7 @@ module Graphiform
136
136
  Helpers.get_const_or_create(demodulized_name, ::Resolvers::Queries) do
137
137
  local_graphql_type = graphql_type
138
138
  Class.new(graphql_base_resolver) do
139
- type local_graphql_type, null: false
139
+ type local_graphql_type, null: true
140
140
 
141
141
  def base_resolve(**args)
142
142
  @value = model.all
@@ -161,9 +161,9 @@ module Graphiform
161
161
  end
162
162
  end
163
163
 
164
- def graphql_create_resolver(method_name, resolver_type = graphql_type, read_prepare: nil, read_resolve: nil, **)
164
+ def graphql_create_resolver(method_name, resolver_type = graphql_type, read_prepare: nil, read_resolve: nil, null: true, **)
165
165
  Class.new(graphql_base_resolver) do
166
- type resolver_type, null: false
166
+ type resolver_type, null: null
167
167
 
168
168
  define_method :base_resolve do |**args|
169
169
  @value = object
@@ -157,7 +157,7 @@ module Graphiform
157
157
  column_def = column(as || name)
158
158
  association_def = association(as || name)
159
159
 
160
- type = ::Enums::Sort if column_def.present?
160
+ type = ::Graphiform::SortEnum if column_def.present?
161
161
  type = association_def.klass.graphql_sort if Helpers.association_arguments_valid?(association_def, :graphql_sort)
162
162
 
163
163
  return if type.blank?
@@ -265,7 +265,8 @@ module Graphiform
265
265
  association_def.name,
266
266
  klass.graphql_connection,
267
267
  read_prepare: read_prepare,
268
- read_resolve: read_resolve
268
+ read_resolve: read_resolve,
269
+ null: false
269
270
  ),
270
271
  false,
271
272
  **options
@@ -279,7 +280,8 @@ module Graphiform
279
280
  association_def.name,
280
281
  [klass.graphql_type],
281
282
  read_prepare: read_prepare,
282
- read_resolve: read_resolve
283
+ read_resolve: read_resolve,
284
+ null: false
283
285
  )
284
286
  else
285
287
  klass.graphql_type
@@ -80,12 +80,5 @@ module Graphiform
80
80
  Helpers.get_const_or_create('BaseEnum', ::Enums) do
81
81
  Class.new(::GraphQL::Schema::Enum)
82
82
  end
83
-
84
- Helpers.get_const_or_create('Sort', ::Enums) do
85
- Class.new(::Enums::BaseEnum) do
86
- value 'ASC', 'Sort results in ascending order'
87
- value 'DESC', 'Sort results in descending order'
88
- end
89
- end
90
83
  end
91
84
  end
@@ -0,0 +1,8 @@
1
+ require 'graphql'
2
+
3
+ module Graphiform
4
+ class SortEnum < ::GraphQL::Schema::Enum
5
+ value 'ASC', 'Sort results in ascending order'
6
+ value 'DESC', 'Sort results in descending order'
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Graphiform
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.2.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - jayce.pulsipher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-28 00:00:00.000000000 Z
11
+ date: 2021-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.2.2
47
+ version: 0.2.6
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.2.2
54
+ version: 0.2.6
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: appraisal
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -124,6 +124,7 @@ files:
124
124
  - lib/graphiform/fields.rb
125
125
  - lib/graphiform/helpers.rb
126
126
  - lib/graphiform/skeleton.rb
127
+ - lib/graphiform/sort_enum.rb
127
128
  - lib/graphiform/version.rb
128
129
  - lib/tasks/graphiform_tasks.rake
129
130
  homepage: https://github.com/3-form/graphiform
@@ -145,7 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
148
  requirements: []
148
- rubygems_version: 3.0.3
149
+ rubyforge_project:
150
+ rubygems_version: 2.7.7
149
151
  signing_key:
150
152
  specification_version: 4
151
153
  summary: Generate GraphQL types, inputs, resolvers, queries, and connections based