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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aab866d81cb8b70ef283c47914ea056c15eb07000b701414a42a7055fe1dabe1
4
- data.tar.gz: 814a9189c63ffee28c8ab47c761b8740680da723669ea05d0d0e2256770b61d7
3
+ metadata.gz: 66c6e2cd4ba018ee3af6aa4461b67b29ed202d21a93b5d0ea877d5fdfdecfbc7
4
+ data.tar.gz: 5955a5e193a761dd3821107bb60c02db6aa8d72717b0288b4863b79920a8ad4e
5
5
  SHA512:
6
- metadata.gz: 99fe93c9a15507f4ebd0c1ec8667ddeac6b211342ca4df65b4a866fd3ba1dc34dd5661c4fba8317e4deea5241b9c52a2cb176e9d1dc0d9a57ec57d464f7e1dfa
7
- data.tar.gz: db4a1d9fb7d4c9a20fb449a54ae5c27e784c39672052d5f95e0c7927801eaebe3c88c4899e8477da3d892c7ff420cdc29a15b3753cf6ec1e9c94c946f6c6de66
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.0](2021-02-15)
12
+ ## [1.2.1](2021-02-17)
13
13
 
14
- * Added/Changed/Deprecated/Removed/Fixed/Security: YOUR CHANGE HERE
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_rails (1.2.0)
4
+ graphql_rails (1.2.1)
5
5
  activesupport (>= 4)
6
6
  graphql (~> 1.12, >= 1.12.4)
7
7
 
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, deleteUser mutations and user, users queries.
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(amount: :integer!)`
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 require_auth_token
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, deleteUser mutations and user, users queries.
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]((components/routes) on how to do that) and you want to render group specific schema, you need to provide group name, like this:
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]((components/routes). In order to generate schema for one of groups, provide optional `name` argument:
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']
@@ -47,7 +47,7 @@ module GraphqlRails
47
47
  end
48
48
 
49
49
  def scalar_type?
50
- type_parser.raw_graphql_type? || type_parser.unwrapped_scalar_type.class == GraphQL::ScalarType
50
+ type_parser.raw_graphql_type? || type_parser.core_scalar_type?
51
51
  end
52
52
 
53
53
  private
@@ -27,11 +27,11 @@ module GraphqlRails
27
27
  @graphql_type ||= \
28
28
  case name
29
29
  when 'id', /_id\Z/
30
- GraphQL::ID_TYPE
30
+ GraphQL::Types::ID
31
31
  when /\?\Z/
32
- GraphQL::BOOLEAN_TYPE
32
+ GraphQL::Types::Boolean
33
33
  else
34
- GraphQL::STRING_TYPE
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::ID_TYPE,
14
+ 'id' => GraphQL::Types::ID,
15
15
 
16
- 'int' => GraphQL::INT_TYPE,
17
- 'integer' => GraphQL::INT_TYPE,
16
+ 'int' => GraphQL::Types::Int,
17
+ 'integer' => GraphQL::Types::Int,
18
18
 
19
- 'string' => GraphQL::STRING_TYPE,
20
- 'str' => GraphQL::STRING_TYPE,
21
- 'text' => GraphQL::STRING_TYPE,
22
- 'time' => GraphQL::STRING_TYPE,
23
- 'date' => GraphQL::STRING_TYPE,
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::BOOLEAN_TYPE,
26
- 'boolean' => GraphQL::BOOLEAN_TYPE,
25
+ 'bool' => GraphQL::Types::Boolean,
26
+ 'boolean' => GraphQL::Types::Boolean,
27
27
 
28
- 'float' => GraphQL::FLOAT_TYPE,
29
- 'double' => GraphQL::FLOAT_TYPE,
30
- 'decimal' => GraphQL::FLOAT_TYPE
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
@@ -30,12 +30,6 @@ module GraphqlRails
30
30
 
31
31
  query(query_type) if query_type
32
32
  mutation(mutation_type) if mutation_type
33
-
34
- def self.type_from_ast(*args)
35
- type = super
36
-
37
- type.respond_to?(:to_graphql) ? type.to_graphql : type
38
- end
39
33
  end
40
34
  end
41
35
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlRails
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1'
5
5
  end
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.0
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-15 00:00:00.000000000 Z
11
+ date: 2021-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql