graphql_rails 1.2.1 → 1.2.6
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/.github/workflows/ruby.yml +18 -0
- data/.hound.yml +1 -1
- data/.rubocop.yml +1 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +26 -24
- data/docs/README.md +1 -1
- data/lib/graphql_rails/attributes/attributable.rb +3 -5
- data/lib/graphql_rails/input_configurable.rb +8 -3
- data/lib/graphql_rails/model/build_connection_type/count_items.rb +1 -1
- data/lib/graphql_rails/model/build_connection_type.rb +1 -1
- data/lib/graphql_rails/model/configurable.rb +8 -0
- data/lib/graphql_rails/model/configuration.rb +18 -1
- data/lib/graphql_rails/model/find_or_build_graphql_type.rb +4 -3
- data/lib/graphql_rails/model/input.rb +0 -5
- data/lib/graphql_rails/model.rb +1 -1
- data/lib/graphql_rails/tasks/dump_graphql_schema.rb +2 -2
- data/lib/graphql_rails/version.rb +1 -1
- metadata +8 -8
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f7c503110a2423bb3e0b90154f9d0c4f6daeabc3315a1c49c1a832a29366ff2
|
|
4
|
+
data.tar.gz: bfc7779f2678094724d0d1c3368edaa792665493a32d5112c5864998879fe96c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 740f486bb00615a7b83a78a8d5dc6d72d7d57dc0a42385178d1cc87875e264f0370f3131ca1e327f8d510f2126b7956915ead75374b06c81e99c96f98b6d57b9
|
|
7
|
+
data.tar.gz: df08d0a84e9f505d25922d460677ddf2d34e5333258d111e9ee95090747612ccbb789d4f44d88f9cb1779a2afd4bbe4765b1ecabb1e88e2d75b777a05f94f3a4
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Ruby
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
specs:
|
|
5
|
+
strategy:
|
|
6
|
+
matrix:
|
|
7
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
|
8
|
+
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
env:
|
|
11
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v2
|
|
14
|
+
- uses: ruby/setup-ruby@v1
|
|
15
|
+
with:
|
|
16
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
17
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
18
|
+
- run: bundle exec rake
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.0.1
|
data/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
* Added/Changed/Deprecated/Removed/Fixed/Security: YOUR CHANGE HERE
|
|
11
11
|
|
|
12
|
+
## [1.2.4](2021-05-05)
|
|
13
|
+
|
|
14
|
+
* Fixed: Dynamic types definition where type A references type B referencing type A.
|
|
15
|
+
|
|
16
|
+
## [1.2.3](2021-04-12)
|
|
17
|
+
|
|
18
|
+
* Fixed: Total count on paginated resources
|
|
19
|
+
|
|
20
|
+
## [1.2.2](2021-02-19)
|
|
21
|
+
|
|
22
|
+
* Fixed: Incorrect type resolution for required list type fields in model declaration.
|
|
23
|
+
|
|
12
24
|
## [1.2.1](2021-02-17)
|
|
13
25
|
|
|
14
26
|
* Fixed: Incorrect scalar types resolution is fixed. No more `type mismatch between ID / ID`
|
data/Gemfile
CHANGED
|
@@ -5,9 +5,9 @@ source 'https://rubygems.org'
|
|
|
5
5
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
6
6
|
|
|
7
7
|
group :development do
|
|
8
|
-
gem 'rubocop', '
|
|
9
|
-
gem 'rubocop-performance'
|
|
10
|
-
gem 'rubocop-rspec'
|
|
8
|
+
gem 'rubocop', '1.5.2'
|
|
9
|
+
gem 'rubocop-performance'
|
|
10
|
+
gem 'rubocop-rspec'
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
group :test do
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
graphql_rails (1.2.
|
|
4
|
+
graphql_rails (1.2.6)
|
|
5
5
|
activesupport (>= 4)
|
|
6
6
|
graphql (~> 1.12, >= 1.12.4)
|
|
7
7
|
|
|
@@ -63,7 +63,7 @@ GEM
|
|
|
63
63
|
minitest (~> 5.1)
|
|
64
64
|
tzinfo (~> 1.1)
|
|
65
65
|
zeitwerk (~> 2.2, >= 2.2.2)
|
|
66
|
-
ast (2.4.
|
|
66
|
+
ast (2.4.2)
|
|
67
67
|
bson (4.11.0)
|
|
68
68
|
builder (3.2.4)
|
|
69
69
|
byebug (11.1.3)
|
|
@@ -78,7 +78,7 @@ GEM
|
|
|
78
78
|
erubi (1.9.0)
|
|
79
79
|
globalid (0.4.2)
|
|
80
80
|
activesupport (>= 4.2.0)
|
|
81
|
-
graphql (1.12.
|
|
81
|
+
graphql (1.12.10)
|
|
82
82
|
i18n (1.8.5)
|
|
83
83
|
concurrent-ruby (~> 1.0)
|
|
84
84
|
json (2.3.1)
|
|
@@ -90,9 +90,11 @@ GEM
|
|
|
90
90
|
marcel (0.3.3)
|
|
91
91
|
mimemagic (~> 0.3.2)
|
|
92
92
|
method_source (1.0.0)
|
|
93
|
-
mimemagic (0.3.
|
|
93
|
+
mimemagic (0.3.10)
|
|
94
|
+
nokogiri (~> 1)
|
|
95
|
+
rake
|
|
94
96
|
mini_mime (1.0.2)
|
|
95
|
-
mini_portile2 (2.
|
|
97
|
+
mini_portile2 (2.6.1)
|
|
96
98
|
minitest (5.14.2)
|
|
97
99
|
mongo (2.13.1)
|
|
98
100
|
bson (>= 4.8.2, < 5.0.0)
|
|
@@ -100,11 +102,11 @@ GEM
|
|
|
100
102
|
activemodel (>= 5.1, < 6.1)
|
|
101
103
|
mongo (>= 2.7.0, < 3.0.0)
|
|
102
104
|
nio4r (2.5.4)
|
|
103
|
-
nokogiri (1.
|
|
104
|
-
mini_portile2 (~> 2.
|
|
105
|
+
nokogiri (1.12.5)
|
|
106
|
+
mini_portile2 (~> 2.6.1)
|
|
105
107
|
racc (~> 1.4)
|
|
106
|
-
parallel (1.
|
|
107
|
-
parser (
|
|
108
|
+
parallel (1.20.1)
|
|
109
|
+
parser (3.0.1.1)
|
|
108
110
|
ast (~> 2.4.1)
|
|
109
111
|
pry (0.13.1)
|
|
110
112
|
coderay (~> 1.1)
|
|
@@ -144,8 +146,8 @@ GEM
|
|
|
144
146
|
thor (>= 0.20.3, < 2.0)
|
|
145
147
|
rainbow (3.0.0)
|
|
146
148
|
rake (13.0.1)
|
|
147
|
-
regexp_parser (1.
|
|
148
|
-
rexml (3.2.
|
|
149
|
+
regexp_parser (2.1.1)
|
|
150
|
+
rexml (3.2.5)
|
|
149
151
|
rspec (3.10.0)
|
|
150
152
|
rspec-core (~> 3.10.0)
|
|
151
153
|
rspec-expectations (~> 3.10.0)
|
|
@@ -159,24 +161,24 @@ GEM
|
|
|
159
161
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
160
162
|
rspec-support (~> 3.10.0)
|
|
161
163
|
rspec-support (3.10.0)
|
|
162
|
-
rubocop (
|
|
164
|
+
rubocop (1.5.2)
|
|
163
165
|
parallel (~> 1.10)
|
|
164
|
-
parser (>= 2.7.1.
|
|
166
|
+
parser (>= 2.7.1.5)
|
|
165
167
|
rainbow (>= 2.2.2, < 4.0)
|
|
166
|
-
regexp_parser (>= 1.
|
|
168
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
167
169
|
rexml
|
|
168
|
-
rubocop-ast (>=
|
|
170
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
169
171
|
ruby-progressbar (~> 1.7)
|
|
170
172
|
unicode-display_width (>= 1.4.0, < 2.0)
|
|
171
|
-
rubocop-ast (
|
|
172
|
-
parser (>=
|
|
173
|
+
rubocop-ast (1.5.0)
|
|
174
|
+
parser (>= 3.0.1.1)
|
|
173
175
|
rubocop-performance (1.8.1)
|
|
174
176
|
rubocop (>= 0.87.0)
|
|
175
177
|
rubocop-ast (>= 0.4.0)
|
|
176
|
-
rubocop-rspec (
|
|
177
|
-
rubocop (~> 0
|
|
178
|
-
rubocop-ast (>=
|
|
179
|
-
ruby-progressbar (1.
|
|
178
|
+
rubocop-rspec (2.3.0)
|
|
179
|
+
rubocop (~> 1.0)
|
|
180
|
+
rubocop-ast (>= 1.1.0)
|
|
181
|
+
ruby-progressbar (1.11.0)
|
|
180
182
|
simplecov (0.19.1)
|
|
181
183
|
docile (~> 1.1)
|
|
182
184
|
simplecov-html (~> 0.11)
|
|
@@ -211,9 +213,9 @@ DEPENDENCIES
|
|
|
211
213
|
rails (~> 6)
|
|
212
214
|
rake (~> 13.0)
|
|
213
215
|
rspec (~> 3.0)
|
|
214
|
-
rubocop (=
|
|
215
|
-
rubocop-performance
|
|
216
|
-
rubocop-rspec
|
|
216
|
+
rubocop (= 1.5.2)
|
|
217
|
+
rubocop-performance
|
|
218
|
+
rubocop-rspec
|
|
217
219
|
simplecov
|
|
218
220
|
|
|
219
221
|
BUNDLED WITH
|
data/docs/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GraphqlRails
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
4
|
[](https://codecov.io/gh/samesystem/graphql_rails)
|
|
5
5
|
[](https://samesystem.github.io/graphql_rails)
|
|
6
6
|
|
|
@@ -21,11 +21,9 @@ module GraphqlRails
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def required?
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@required
|
|
28
|
-
end
|
|
24
|
+
return @required unless @required.nil?
|
|
25
|
+
|
|
26
|
+
attribute_name_parser.required? || !initial_type.to_s[/!$/].nil? || initial_type.is_a?(GraphQL::Schema::NonNull)
|
|
29
27
|
end
|
|
30
28
|
|
|
31
29
|
def required
|
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
module GraphqlRails
|
|
4
4
|
# contains configuration options related with inputs
|
|
5
5
|
module InputConfigurable
|
|
6
|
-
def permit(*
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
def permit(*args)
|
|
7
|
+
args.each do |arg|
|
|
8
|
+
if arg.is_a? Hash
|
|
9
|
+
arg.each { |attribute, type| permit_input(attribute, type: type) }
|
|
10
|
+
else
|
|
11
|
+
permit_input(arg)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
9
14
|
self
|
|
10
15
|
end
|
|
11
16
|
|
|
@@ -5,6 +5,14 @@ module GraphqlRails
|
|
|
5
5
|
# contains methods which are shared between various configurations
|
|
6
6
|
# expects `default_name` to be defined
|
|
7
7
|
module Configurable
|
|
8
|
+
def initialize_copy(other)
|
|
9
|
+
super
|
|
10
|
+
@name = nil
|
|
11
|
+
@type_name = nil
|
|
12
|
+
@description = nil
|
|
13
|
+
@attributes = other.attributes.transform_values(&:dup)
|
|
14
|
+
end
|
|
15
|
+
|
|
8
16
|
def attributes
|
|
9
17
|
@attributes ||= {}
|
|
10
18
|
end
|
|
@@ -22,7 +22,6 @@ module GraphqlRails
|
|
|
22
22
|
@connection_type = nil
|
|
23
23
|
@graphql_type = nil
|
|
24
24
|
@input = other.instance_variable_get(:@input)&.transform_values(&:dup)
|
|
25
|
-
@attributes = other.instance_variable_get(:@attributes)&.transform_values(&:dup)
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
def attribute(attribute_name, **attribute_options)
|
|
@@ -68,6 +67,14 @@ module GraphqlRails
|
|
|
68
67
|
@connection_type ||= BuildConnectionType.call(graphql_type)
|
|
69
68
|
end
|
|
70
69
|
|
|
70
|
+
def with_ensured_fields!
|
|
71
|
+
return self if @graphql_type.blank?
|
|
72
|
+
|
|
73
|
+
reset_graphql_type if attributes.any? && graphql_type.fields.length != attributes.length
|
|
74
|
+
|
|
75
|
+
self
|
|
76
|
+
end
|
|
77
|
+
|
|
71
78
|
private
|
|
72
79
|
|
|
73
80
|
attr_reader :model_class
|
|
@@ -75,6 +82,16 @@ module GraphqlRails
|
|
|
75
82
|
def default_name
|
|
76
83
|
@default_name ||= model_class.name.split('::').last
|
|
77
84
|
end
|
|
85
|
+
|
|
86
|
+
def reset_graphql_type
|
|
87
|
+
@graphql_type = FindOrBuildGraphqlType.call(
|
|
88
|
+
name: name,
|
|
89
|
+
description: description,
|
|
90
|
+
attributes: attributes,
|
|
91
|
+
type_name: type_name,
|
|
92
|
+
force_define_attributes: true
|
|
93
|
+
)
|
|
94
|
+
end
|
|
78
95
|
end
|
|
79
96
|
end
|
|
80
97
|
end
|
|
@@ -10,20 +10,21 @@ module GraphqlRails
|
|
|
10
10
|
|
|
11
11
|
include ::GraphqlRails::Service
|
|
12
12
|
|
|
13
|
-
def initialize(name:, description:, attributes:, type_name:)
|
|
13
|
+
def initialize(name:, description:, attributes:, type_name:, force_define_attributes: false)
|
|
14
14
|
@name = name
|
|
15
15
|
@description = description
|
|
16
16
|
@attributes = attributes
|
|
17
17
|
@type_name = type_name
|
|
18
|
+
@force_define_attributes = force_define_attributes
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def call
|
|
21
|
-
klass.tap { add_fields_to_graphql_type if new_class? }
|
|
22
|
+
klass.tap { add_fields_to_graphql_type if new_class? || force_define_attributes }
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
private
|
|
25
26
|
|
|
26
|
-
attr_reader :name, :description, :attributes, :type_name
|
|
27
|
+
attr_reader :name, :description, :attributes, :type_name, :force_define_attributes
|
|
27
28
|
|
|
28
29
|
delegate :klass, :new_class?, to: :type_class_finder
|
|
29
30
|
|
|
@@ -14,11 +14,6 @@ module GraphqlRails
|
|
|
14
14
|
@input_name_suffix = input_name_suffix
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def initialize_copy(other)
|
|
18
|
-
super
|
|
19
|
-
@attributes = other.instance_variable_get(:@attributes)&.transform_values(&:dup)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
17
|
def graphql_input_type
|
|
23
18
|
@graphql_input_type ||= BuildGraphqlInputType.call(
|
|
24
19
|
name: name, description: description, attributes: attributes
|
data/lib/graphql_rails/model.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphql_rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Povilas Jurčys
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: graphql
|
|
@@ -128,19 +128,19 @@ dependencies:
|
|
|
128
128
|
- - "~>"
|
|
129
129
|
- !ruby/object:Gem::Version
|
|
130
130
|
version: '6'
|
|
131
|
-
description:
|
|
131
|
+
description:
|
|
132
132
|
email:
|
|
133
133
|
- po.jurcys@gmail.com
|
|
134
134
|
executables: []
|
|
135
135
|
extensions: []
|
|
136
136
|
extra_rdoc_files: []
|
|
137
137
|
files:
|
|
138
|
+
- ".github/workflows/ruby.yml"
|
|
138
139
|
- ".gitignore"
|
|
139
140
|
- ".hound.yml"
|
|
140
141
|
- ".rspec"
|
|
141
142
|
- ".rubocop.yml"
|
|
142
143
|
- ".ruby-version"
|
|
143
|
-
- ".travis.yml"
|
|
144
144
|
- CHANGELOG.md
|
|
145
145
|
- CODE_OF_CONDUCT.md
|
|
146
146
|
- Gemfile
|
|
@@ -232,7 +232,7 @@ homepage: https://github.com/samesystem/graphql_rails
|
|
|
232
232
|
licenses:
|
|
233
233
|
- MIT
|
|
234
234
|
metadata: {}
|
|
235
|
-
post_install_message:
|
|
235
|
+
post_install_message:
|
|
236
236
|
rdoc_options: []
|
|
237
237
|
require_paths:
|
|
238
238
|
- lib
|
|
@@ -247,8 +247,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
247
247
|
- !ruby/object:Gem::Version
|
|
248
248
|
version: '0'
|
|
249
249
|
requirements: []
|
|
250
|
-
rubygems_version: 3.
|
|
251
|
-
signing_key:
|
|
250
|
+
rubygems_version: 3.2.15
|
|
251
|
+
signing_key:
|
|
252
252
|
specification_version: 4
|
|
253
253
|
summary: Rails style structure for GraphQL API.
|
|
254
254
|
test_files: []
|