graphql_rails 1.2.3 → 1.2.4
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +4 -2
- data/lib/graphql_rails/model.rb +1 -1
- data/lib/graphql_rails/model/configuration.rb +18 -0
- data/lib/graphql_rails/model/find_or_build_graphql_type.rb +4 -3
- data/lib/graphql_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fde3149c0119edc09198e27b61c428ed666ea2bb4582b428142db31a58749c4
|
4
|
+
data.tar.gz: d9faa17f35d1ac01400b829983d6a2b16230c62971bb6ed0178b9a6bf4b1c0bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee735c639cf392c7a4261db07791bb953942977fd4c001fcb101fd3e4a7009db58fb27520d0227e2b3254fdbc5d2dc52043d892597e99d4526ad18fc8919de30
|
7
|
+
data.tar.gz: 80e3a427bb04a91332230460638d7f866afc843dbebfd9e9211454869154c32459e9c1d3c2dcaa97e06bd767792bc6ff742b871ded561094354bc4beab2517a1
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,10 @@ 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
|
+
|
12
16
|
## [1.2.3](2021-04-12)
|
13
17
|
|
14
18
|
* Fixed: Total count on paginated resources
|
data/Gemfile.lock
CHANGED
@@ -90,7 +90,9 @@ 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
97
|
mini_portile2 (2.5.0)
|
96
98
|
minitest (5.14.2)
|
@@ -145,7 +147,7 @@ GEM
|
|
145
147
|
rainbow (3.0.0)
|
146
148
|
rake (13.0.1)
|
147
149
|
regexp_parser (1.8.2)
|
148
|
-
rexml (3.2.
|
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)
|
data/lib/graphql_rails/model.rb
CHANGED
@@ -68,6 +68,14 @@ module GraphqlRails
|
|
68
68
|
@connection_type ||= BuildConnectionType.call(graphql_type)
|
69
69
|
end
|
70
70
|
|
71
|
+
def with_ensured_fields!
|
72
|
+
return self if @graphql_type.blank?
|
73
|
+
|
74
|
+
reset_graphql_type if attributes.any? && graphql_type.fields.length != attributes.length
|
75
|
+
|
76
|
+
self
|
77
|
+
end
|
78
|
+
|
71
79
|
private
|
72
80
|
|
73
81
|
attr_reader :model_class
|
@@ -75,6 +83,16 @@ module GraphqlRails
|
|
75
83
|
def default_name
|
76
84
|
@default_name ||= model_class.name.split('::').last
|
77
85
|
end
|
86
|
+
|
87
|
+
def reset_graphql_type
|
88
|
+
@graphql_type = FindOrBuildGraphqlType.call(
|
89
|
+
name: name,
|
90
|
+
description: description,
|
91
|
+
attributes: attributes,
|
92
|
+
type_name: type_name,
|
93
|
+
force_define_attributes: true
|
94
|
+
)
|
95
|
+
end
|
78
96
|
end
|
79
97
|
end
|
80
98
|
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
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Povilas Jurčys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|