graphql_rails 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -2
- data/Gemfile.lock +1 -1
- data/docs/README.md +1 -1
- data/docs/components/controller.md +2 -2
- data/docs/getting_started/quick_start.md +1 -1
- data/docs/other_tools/query_runner.md +1 -1
- data/docs/other_tools/schema_dump.md +1 -1
- data/lib/graphql_rails/attributes/attributable.rb +1 -1
- data/lib/graphql_rails/attributes/attribute_name_parser.rb +3 -3
- data/lib/graphql_rails/attributes/type_parseable.rb +17 -13
- data/lib/graphql_rails/router/schema_builder.rb +0 -6
- 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: 66c6e2cd4ba018ee3af6aa4461b67b29ed202d21a93b5d0ea877d5fdfdecfbc7
|
4
|
+
data.tar.gz: 5955a5e193a761dd3821107bb60c02db6aa8d72717b0288b4863b79920a8ad4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9342f037b0b41b4a70621787f14188da08693fa773d0efd2e3148c8d6be7e6086e3ae8215d349e72ab3a7448643f49ca7ccc2fe9c3d5a911d152a9a06131d164
|
7
|
+
data.tar.gz: c3ef9dda6a219e42394e3027fe4710af88360c8f699a13d8bc66a11c1bf8c31a25a295e6a217d8c1b04e6826899e24d73950a279d5f5505893601181e6da8d28
|
data/CHANGELOG.md
CHANGED
@@ -9,9 +9,11 @@ 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.
|
12
|
+
## [1.2.1](2021-02-17)
|
13
13
|
|
14
|
-
*
|
14
|
+
* Fixed: Incorrect scalar types resolution is fixed. No more `type mismatch between ID / ID`
|
15
|
+
|
16
|
+
## [1.2.0](2021-02-15)
|
15
17
|
|
16
18
|
* Added: `options` argument to model level attribute. Allows disabling automatic camelCase
|
17
19
|
* Fixed: methods with complex input arguments receives `Hash` instances instead of `GraphQL::Schema::InputObject`
|
data/Gemfile.lock
CHANGED
data/docs/README.md
CHANGED
@@ -37,7 +37,7 @@ This will generate code which will let you start your graphql faster
|
|
37
37
|
```ruby
|
38
38
|
# config/graphql/routes.rb
|
39
39
|
GraphqlRails::Router.draw do
|
40
|
-
# will create createUser, updateUser,
|
40
|
+
# will create createUser, updateUser, destroyUser mutations and user, users queries.
|
41
41
|
# expects that UsersController class exist
|
42
42
|
resources :users
|
43
43
|
|
@@ -78,7 +78,7 @@ Specifies input type:
|
|
78
78
|
class OrderController < GraphqlRails::Controller
|
79
79
|
action(:create)
|
80
80
|
.permit_input(:price, type: :integer!)
|
81
|
-
# Same as `.permit(
|
81
|
+
# Same as `.permit(price: :integer!)`
|
82
82
|
end
|
83
83
|
```
|
84
84
|
|
@@ -446,7 +446,7 @@ class UsersController < GraphqlRails::Controller
|
|
446
446
|
raise 'Not authenticated' unless User.where(token: params[:token]).exist?
|
447
447
|
end
|
448
448
|
|
449
|
-
def
|
449
|
+
def require_admin_token
|
450
450
|
raise 'Admin not authenticated' unless Admin.where(token: params[:admin_token]).exist?
|
451
451
|
end
|
452
452
|
end
|
@@ -11,7 +11,7 @@ bundle exec rails g graphql_rails:install
|
|
11
11
|
```ruby
|
12
12
|
# config/graphql/routes.rb
|
13
13
|
GraphqlRails::Router.draw do
|
14
|
-
# will create createUser, updateUser,
|
14
|
+
# will create createUser, updateUser, destroyUser mutations and user, users queries.
|
15
15
|
# expects that UsersController class exist
|
16
16
|
resources :users
|
17
17
|
|
@@ -16,7 +16,7 @@ end
|
|
16
16
|
|
17
17
|
## Executing grouped schema
|
18
18
|
|
19
|
-
If you have multiple schemas (read [routes section](
|
19
|
+
If you have multiple schemas (read [routes section](components/routes) on how to do that) and you want to render group specific schema, you need to provide group name, like this:
|
20
20
|
|
21
21
|
```ruby
|
22
22
|
class MyRailsClass < ApplicationController
|
@@ -8,7 +8,7 @@ rake graphql_rails:schema:dump
|
|
8
8
|
|
9
9
|
## Dumping non default schema
|
10
10
|
|
11
|
-
You can have multiple graphql schemas. Read more about this in [routes section](
|
11
|
+
You can have multiple graphql schemas. Read more about this in [routes section](components/routes). In order to generate schema for one of groups, provide optional `name` argument:
|
12
12
|
|
13
13
|
```bash
|
14
14
|
rake graphql_rails:schema:dump['your_group_name']
|
@@ -27,11 +27,11 @@ module GraphqlRails
|
|
27
27
|
@graphql_type ||= \
|
28
28
|
case name
|
29
29
|
when 'id', /_id\Z/
|
30
|
-
GraphQL::
|
30
|
+
GraphQL::Types::ID
|
31
31
|
when /\?\Z/
|
32
|
-
GraphQL::
|
32
|
+
GraphQL::Types::Boolean
|
33
33
|
else
|
34
|
-
GraphQL::
|
34
|
+
GraphQL::Types::String
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -11,23 +11,23 @@ module GraphqlRails
|
|
11
11
|
class UnknownTypeError < ArgumentError; end
|
12
12
|
|
13
13
|
TYPE_MAPPING = {
|
14
|
-
'id' => GraphQL::
|
14
|
+
'id' => GraphQL::Types::ID,
|
15
15
|
|
16
|
-
'int' => GraphQL::
|
17
|
-
'integer' => GraphQL::
|
16
|
+
'int' => GraphQL::Types::Int,
|
17
|
+
'integer' => GraphQL::Types::Int,
|
18
18
|
|
19
|
-
'string' => GraphQL::
|
20
|
-
'str' => GraphQL::
|
21
|
-
'text' => GraphQL::
|
22
|
-
'time' => GraphQL::
|
23
|
-
'date' => GraphQL::
|
19
|
+
'string' => GraphQL::Types::String,
|
20
|
+
'str' => GraphQL::Types::String,
|
21
|
+
'text' => GraphQL::Types::String,
|
22
|
+
'time' => GraphQL::Types::String,
|
23
|
+
'date' => GraphQL::Types::String,
|
24
24
|
|
25
|
-
'bool' => GraphQL::
|
26
|
-
'boolean' => GraphQL::
|
25
|
+
'bool' => GraphQL::Types::Boolean,
|
26
|
+
'boolean' => GraphQL::Types::Boolean,
|
27
27
|
|
28
|
-
'float' => GraphQL::
|
29
|
-
'double' => GraphQL::
|
30
|
-
'decimal' => GraphQL::
|
28
|
+
'float' => GraphQL::Types::Float,
|
29
|
+
'double' => GraphQL::Types::Float,
|
30
|
+
'decimal' => GraphQL::Types::Float
|
31
31
|
}.freeze
|
32
32
|
|
33
33
|
WRAPPER_TYPES = [
|
@@ -57,6 +57,10 @@ module GraphqlRails
|
|
57
57
|
unparsed_type < GraphQL::Schema::Member
|
58
58
|
end
|
59
59
|
|
60
|
+
def core_scalar_type?
|
61
|
+
unwrapped_scalar_type.in?(TYPE_MAPPING.values)
|
62
|
+
end
|
63
|
+
|
60
64
|
def graphql_model
|
61
65
|
type_class = \
|
62
66
|
if unparsed_type.is_a?(Class) && unparsed_type < GraphqlRails::Model
|
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.1
|
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-02-
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|