graphql_rails 1.0.0 → 1.2.3
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/.hound.yml +1 -0
- data/.rubocop.yml +3 -3
- data/.ruby-version +1 -1
- data/.travis.yml +2 -2
- data/CHANGELOG.md +22 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +145 -119
- data/docs/README.md +3 -3
- data/docs/components/controller.md +23 -7
- data/docs/components/model.md +43 -3
- data/docs/getting_started/quick_start.md +1 -1
- data/docs/index.html +1 -1
- data/docs/other_tools/query_runner.md +1 -1
- data/docs/other_tools/schema_dump.md +1 -1
- data/graphql_rails.gemspec +5 -5
- data/lib/generators/graphql_rails/templates/graphql_router_spec.erb +10 -7
- data/lib/graphql_rails/attributes/attributable.rb +5 -9
- data/lib/graphql_rails/attributes/attribute.rb +26 -6
- data/lib/graphql_rails/attributes/attribute_name_parser.rb +4 -4
- data/lib/graphql_rails/attributes/input_attribute.rb +5 -1
- data/lib/graphql_rails/attributes/type_parseable.rb +17 -13
- data/lib/graphql_rails/concerns/service.rb +6 -2
- data/lib/graphql_rails/controller.rb +6 -6
- data/lib/graphql_rails/controller/action.rb +5 -1
- data/lib/graphql_rails/controller/build_controller_action_resolver.rb +2 -2
- data/lib/graphql_rails/controller/log_controller_action.rb +7 -2
- data/lib/graphql_rails/controller/request.rb +1 -1
- data/lib/graphql_rails/controller/request/format_errors.rb +1 -1
- data/lib/graphql_rails/decorator/relation_decorator.rb +0 -4
- data/lib/graphql_rails/model/add_fields_to_graphql_type.rb +45 -0
- data/lib/graphql_rails/model/build_connection_type.rb +5 -1
- data/lib/graphql_rails/model/build_connection_type/count_items.rb +2 -2
- data/lib/graphql_rails/model/build_graphql_input_type.rb +1 -1
- data/lib/graphql_rails/model/call_graphql_model_method.rb +14 -1
- data/lib/graphql_rails/model/configurable.rb +6 -2
- data/lib/graphql_rails/model/configuration.rb +9 -4
- data/lib/graphql_rails/model/find_or_build_graphql_type.rb +64 -0
- data/lib/graphql_rails/model/find_or_build_graphql_type_class.rb +46 -0
- data/lib/graphql_rails/router.rb +2 -2
- data/lib/graphql_rails/router/resource_routes_builder.rb +8 -8
- data/lib/graphql_rails/router/route.rb +3 -7
- data/lib/graphql_rails/router/schema_builder.rb +5 -1
- data/lib/graphql_rails/rspec_controller_helpers.rb +2 -2
- data/lib/graphql_rails/version.rb +1 -1
- metadata +25 -18
- data/lib/graphql_rails/model/build_graphql_type.rb +0 -53
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.3
|
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:
|
11
|
+
date: 2021-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
17
20
|
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
22
|
+
version: 1.12.4
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.12'
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
32
|
+
version: 1.12.4
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: activesupport
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +50,28 @@ dependencies:
|
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '2'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '2'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rake
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
67
|
+
version: '13.0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
74
|
+
version: '13.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: rspec
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,15 +120,15 @@ dependencies:
|
|
114
120
|
requirements:
|
115
121
|
- - "~>"
|
116
122
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
123
|
+
version: '6'
|
118
124
|
type: :development
|
119
125
|
prerelease: false
|
120
126
|
version_requirements: !ruby/object:Gem::Requirement
|
121
127
|
requirements:
|
122
128
|
- - "~>"
|
123
129
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
125
|
-
description:
|
130
|
+
version: '6'
|
131
|
+
description:
|
126
132
|
email:
|
127
133
|
- po.jurcys@gmail.com
|
128
134
|
executables: []
|
@@ -198,14 +204,16 @@ files:
|
|
198
204
|
- lib/graphql_rails/integrations/lograge.rb
|
199
205
|
- lib/graphql_rails/integrations/sentry.rb
|
200
206
|
- lib/graphql_rails/model.rb
|
207
|
+
- lib/graphql_rails/model/add_fields_to_graphql_type.rb
|
201
208
|
- lib/graphql_rails/model/build_connection_type.rb
|
202
209
|
- lib/graphql_rails/model/build_connection_type/count_items.rb
|
203
210
|
- lib/graphql_rails/model/build_enum_type.rb
|
204
211
|
- lib/graphql_rails/model/build_graphql_input_type.rb
|
205
|
-
- lib/graphql_rails/model/build_graphql_type.rb
|
206
212
|
- lib/graphql_rails/model/call_graphql_model_method.rb
|
207
213
|
- lib/graphql_rails/model/configurable.rb
|
208
214
|
- lib/graphql_rails/model/configuration.rb
|
215
|
+
- lib/graphql_rails/model/find_or_build_graphql_type.rb
|
216
|
+
- lib/graphql_rails/model/find_or_build_graphql_type_class.rb
|
209
217
|
- lib/graphql_rails/model/input.rb
|
210
218
|
- lib/graphql_rails/query_runner.rb
|
211
219
|
- lib/graphql_rails/railtie.rb
|
@@ -224,7 +232,7 @@ homepage: https://github.com/samesystem/graphql_rails
|
|
224
232
|
licenses:
|
225
233
|
- MIT
|
226
234
|
metadata: {}
|
227
|
-
post_install_message:
|
235
|
+
post_install_message:
|
228
236
|
rdoc_options: []
|
229
237
|
require_paths:
|
230
238
|
- lib
|
@@ -239,9 +247,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
247
|
- !ruby/object:Gem::Version
|
240
248
|
version: '0'
|
241
249
|
requirements: []
|
242
|
-
|
243
|
-
|
244
|
-
signing_key:
|
250
|
+
rubygems_version: 3.1.2
|
251
|
+
signing_key:
|
245
252
|
specification_version: 4
|
246
|
-
summary:
|
253
|
+
summary: Rails style structure for GraphQL API.
|
247
254
|
test_files: []
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module GraphqlRails
|
4
|
-
module Model
|
5
|
-
# stores information about model specific config, like attributes and types
|
6
|
-
class BuildGraphqlType
|
7
|
-
require 'graphql_rails/concerns/service'
|
8
|
-
require 'graphql_rails/model/call_graphql_model_method'
|
9
|
-
|
10
|
-
include ::GraphqlRails::Service
|
11
|
-
|
12
|
-
PAGINATION_KEYS = %i[before after first last].freeze
|
13
|
-
|
14
|
-
def initialize(name:, description: nil, attributes:)
|
15
|
-
@name = name
|
16
|
-
@attributes = attributes
|
17
|
-
@description = description
|
18
|
-
end
|
19
|
-
|
20
|
-
def call
|
21
|
-
type_name = name
|
22
|
-
type_description = description
|
23
|
-
type_attributes = attributes
|
24
|
-
|
25
|
-
Class.new(GraphQL::Schema::Object) do
|
26
|
-
graphql_name(type_name)
|
27
|
-
description(type_description)
|
28
|
-
|
29
|
-
type_attributes.each_value do |attribute|
|
30
|
-
field(*attribute.field_args) do
|
31
|
-
attribute.attributes.values.each do |arg_attribute|
|
32
|
-
argument(*arg_attribute.input_argument_args)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
define_method attribute.property do |**kwargs|
|
37
|
-
CallGraphqlModelMethod.call(
|
38
|
-
model: object,
|
39
|
-
attribute_config: attribute,
|
40
|
-
method_keyword_arguments: kwargs,
|
41
|
-
graphql_context: context
|
42
|
-
)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
attr_reader :attributes, :name, :description
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|