rails-graphql 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38fafc81ae4e9f8c11c4d1495b8290656dcf388ac0b6d5536829e0f77ee09bb2
4
- data.tar.gz: 8a8298e375df5ac6905b24deeacf29ca2fd7b4dc39dfb43601ba2331828ac939
3
+ metadata.gz: d610a5ff87d748320cba5705f819c0832146a28be41ffdfe9ebd8d13772b7326
4
+ data.tar.gz: 390b994294e6f7ee5f51feadb8dc0102d4d79816d90615b25ca46994bb62e66a
5
5
  SHA512:
6
- metadata.gz: fa92f53a2111c001863967bca893a25bab09f9a9c163af945631a15054c865db2e9102467e8c85ac1c3cbc0591c377a97f98c2439bdc94c72694d72cbef99e05
7
- data.tar.gz: d994c9ff91179fbd72ecb3afde6f3bb005805697ebe994cfcc88b2bc9720e30f16ac76f6dab81b65760ad3e61af5db427d9a5e9118f6222b756df00c35b499d7
6
+ metadata.gz: 738aab60ab153f08f180909a89577cc802c9171b1199763a540094aaf16ebe3169a0a75a49a5de0124383b555ab40d39448201031e71d0caa8ea52b1bc132229
7
+ data.tar.gz: 4f41e879a2501cbca1c1826c0c5e620e3506f156a4bcc4529d342dc9383109efdd33a25201b4959382967a73b6af29db29328db2ea30c31aa0d411c2c446c5c5
@@ -37,6 +37,11 @@ Rails::GraphQL.configure do |config|
37
37
  # different suffix, change this value to it.
38
38
  # config.auto_suffix_input_objects = 'Input'
39
39
 
40
+ # Set if the server should allow strings be used as input for ENUM inputs.
41
+ # It means that operations will support quotes for ENUM values embedded in
42
+ # the documents (heredoc won't be accepted).
43
+ # config.allow_string_as_enum_input = false
44
+
40
45
  # Introspection is enabled by default. It is recommended to only use
41
46
  # introspection during development and tests, never in production.
42
47
  # This can also be set per schema level.
@@ -19,6 +19,8 @@ module Rails
19
19
  # Helper method to initialize an operation given the node
20
20
  def build(request, node)
21
21
  request.build(const_get(node.type.to_s.classify, false), request, node)
22
+ rescue ::NameError
23
+ raise NameError, +%[Unable to initialize "#{node.type}" operation.]
22
24
  end
23
25
 
24
26
  # Rewrite the kind to always return +:operation+
@@ -14,7 +14,7 @@ module Rails
14
14
  module VERSION
15
15
  MAJOR = 1
16
16
  MINOR = 0
17
- TINY = 0
17
+ TINY = 1
18
18
  PRE = nil
19
19
 
20
20
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
@@ -0,0 +1,21 @@
1
+ require 'config'
2
+
3
+ class GraphQL_Request_Component_OperationTest < GraphQL::TestCase
4
+ def test_build
5
+ request = Object.new
6
+ request.define_singleton_method(:build) { |klass, *| klass }
7
+
8
+ assert_equal(klass::Query, klass.build(request, new_token('', :query)))
9
+ assert_equal(klass::Mutation, klass.build(request, new_token('', :mutation)))
10
+ assert_equal(klass::Subscription, klass.build(request, new_token('', :subscription)))
11
+
12
+ assert_raises(Rails::GraphQL::NameError) { klass.build(request, new_token('', '')) }
13
+ assert_raises(Rails::GraphQL::NameError) { klass.build(request, new_token('', :field)) }
14
+ end
15
+
16
+ private
17
+
18
+ def klass
19
+ Rails::GraphQL::Request::Component::Operation
20
+ end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-30 00:00:00.000000000 Z
11
+ date: 2024-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -349,6 +349,7 @@ files:
349
349
  - test/assets/sqlite.gql
350
350
  - test/assets/translate.gql
351
351
  - test/config.rb
352
+ - test/graphql/request/component/operation_test.rb
352
353
  - test/graphql/request/context_test.rb
353
354
  - test/graphql/schema_test.rb
354
355
  - test/graphql/source_test.rb
@@ -433,6 +434,7 @@ test_files:
433
434
  - test/assets/sqlite.gql
434
435
  - test/assets/translate.gql
435
436
  - test/config.rb
437
+ - test/graphql/request/component/operation_test.rb
436
438
  - test/graphql/request/context_test.rb
437
439
  - test/graphql/schema_test.rb
438
440
  - test/graphql/source_test.rb