oriole 0.1.0.alpha.0

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.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +56 -0
  3. data/.rubocop.yml +32 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +1 -0
  6. data/Gemfile +20 -0
  7. data/Gemfile.lock +121 -0
  8. data/LICENSE +21 -0
  9. data/README.md +84 -0
  10. data/Rakefile +12 -0
  11. data/bench/bench.rb +35 -0
  12. data/bench/execute.rb +66 -0
  13. data/bench/schemas/bluejay.rb +149 -0
  14. data/bench/schemas/models.rb +216 -0
  15. data/bench/schemas/oriole.rb +144 -0
  16. data/bin/console +15 -0
  17. data/bin/setup +8 -0
  18. data/bin/style +2 -0
  19. data/bin/tapioca +27 -0
  20. data/bin/typecheck +2 -0
  21. data/lib/oriole/builtin_scalar_definition.rb +53 -0
  22. data/lib/oriole/definition/abstract/definition.rb +21 -0
  23. data/lib/oriole/definition/abstract/field_definition.rb +22 -0
  24. data/lib/oriole/definition/abstract/object_type_definition.rb +21 -0
  25. data/lib/oriole/definition/abstract/schema_definition.rb +18 -0
  26. data/lib/oriole/definition/abstract/visibility.rb +18 -0
  27. data/lib/oriole/definition/base_output_type.rb +13 -0
  28. data/lib/oriole/definition/field_definition.rb +27 -0
  29. data/lib/oriole/definition/object_type.rb +40 -0
  30. data/lib/oriole/definition/output_type.rb +79 -0
  31. data/lib/oriole/definition/schema.rb +45 -0
  32. data/lib/oriole/definition/visibility_scoped/object_type_definition.rb +62 -0
  33. data/lib/oriole/definition/visibility_scoped/schema_definition.rb +26 -0
  34. data/lib/oriole/execution/coerce_result.rb +16 -0
  35. data/lib/oriole/execution/engine.rb +207 -0
  36. data/lib/oriole/version.rb +6 -0
  37. data/lib/oriole.rb +14 -0
  38. data/oriole.gemspec +38 -0
  39. data/rakelib/bench.rake +69 -0
  40. data/sorbet/config +5 -0
  41. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  42. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  43. data/sorbet/rbi/gems/base64@0.1.1.rbi +172 -0
  44. data/sorbet/rbi/gems/bluejay@0.1.0.alpha.2-a45c1b3b47aa4524f94bbe03db5ff1ae792afd09.rbi +1206 -0
  45. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
  46. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  47. data/sorbet/rbi/gems/json@2.6.3.rbi +1533 -0
  48. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  49. data/sorbet/rbi/gems/minitest@5.19.0.rbi +1491 -0
  50. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  51. data/sorbet/rbi/gems/parallel@1.23.0.rbi +273 -0
  52. data/sorbet/rbi/gems/parser@3.2.2.3.rbi +7253 -0
  53. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  54. data/sorbet/rbi/gems/racc@1.7.1.rbi +161 -0
  55. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  56. data/sorbet/rbi/gems/rake@13.0.6.rbi +3024 -0
  57. data/sorbet/rbi/gems/rbi@0.0.17.rbi +2972 -0
  58. data/sorbet/rbi/gems/regexp_parser@2.8.1.rbi +3749 -0
  59. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
  60. data/sorbet/rbi/gems/rubocop-ast@1.29.0.rbi +7006 -0
  61. data/sorbet/rbi/gems/rubocop-minitest@0.27.0.rbi +2371 -0
  62. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +328 -0
  63. data/sorbet/rbi/gems/rubocop-shopify@2.14.0.rbi +8 -0
  64. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +975 -0
  65. data/sorbet/rbi/gems/rubocop@1.56.1.rbi +56525 -0
  66. data/sorbet/rbi/gems/ruby-lsp@0.4.5.rbi +11 -0
  67. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  68. data/sorbet/rbi/gems/spoom@1.2.3.rbi +3203 -0
  69. data/sorbet/rbi/gems/syntax_tree@6.1.1.rbi +22855 -0
  70. data/sorbet/rbi/gems/tapioca@0.11.8.rbi +3349 -0
  71. data/sorbet/rbi/gems/thor@1.2.2.rbi +3965 -0
  72. data/sorbet/rbi/gems/tinygql@0.1.4.rbi +2363 -0
  73. data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +65 -0
  74. data/sorbet/rbi/gems/unparser@0.6.8.rbi +4525 -0
  75. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  76. data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
  77. data/sorbet/rbi/gems/zeitwerk@2.6.11.rbi +999 -0
  78. data/sorbet/tapioca/config.yml +13 -0
  79. data/sorbet/tapioca/require.rb +5 -0
  80. metadata +208 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3980000fdb8c01321628cf597f3c15ae043f53c962a8cb28cd36f510a2257fe8
4
+ data.tar.gz: 9ab73fd8f5f0c7b7c970bcc7eca1c35a117f278280bd3334741a47a49615608c
5
+ SHA512:
6
+ metadata.gz: 8d73c9afdf4b033b19ab48010815fdb0a83ff5e30182851d299fd739a22d0a2bcdc185f8960e6a06cba25f28ceef99e2b045b43b2fe7ea7e02d657823d93b519
7
+ data.tar.gz: b89be1561d1398fbc2de5487a828141e0600b7b0274678b9f98a6daa57f54992e8aa587d8b0dffd42c2194ded90fe200dd4dd575208d1eed352f45519e91a60e
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
data/.rubocop.yml ADDED
@@ -0,0 +1,32 @@
1
+ inherit_gem:
2
+ rubocop-shopify: rubocop.yml
3
+
4
+ require:
5
+ - rubocop-rake
6
+ - rubocop-minitest
7
+ - rubocop-sorbet
8
+
9
+ AllCops:
10
+ TargetRubyVersion: 3.2
11
+ SuggestExtensions: false
12
+ NewCops: enable
13
+
14
+ Sorbet/ValidSigil:
15
+ MinimumStrictness: true
16
+ Enabled: true
17
+ Exclude:
18
+ - "bench/**/*.rb"
19
+ - "rakelib/**/*.rake"
20
+
21
+ Sorbet/FalseSigil:
22
+ Enabled: false
23
+
24
+ Sorbet/StrictSigil:
25
+ Enabled: true
26
+ Exclude:
27
+ - "test/**/*.rb"
28
+ - "bench/**/*.rb"
29
+ - "rakelib/**/*.rake"
30
+
31
+ Sorbet/ConstantsFromStrings:
32
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/CHANGELOG.md ADDED
@@ -0,0 +1 @@
1
+ # Changelog
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in oriole.gemspec
8
+ gemspec
9
+
10
+ group :development do
11
+ gem "rubocop", "~> 1.21", require: false
12
+ gem "rubocop-minitest", "~> 0.27.0", require: false
13
+ gem "rubocop-rake", "~> 0.6.0", require: false
14
+ gem "rubocop-shopify", "~> 2.12", require: false
15
+ gem "rubocop-sorbet", "~> 0.6.11", require: false
16
+ gem "ruby-lsp", "~> 0.4.0", require: false
17
+ gem "sorbet", "~> 0.5"
18
+ gem "tapioca", require: false
19
+ gem "bluejay", "~> 0.1.0.alpha.2"
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,121 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ oriole (0.1.0.alpha.0)
5
+ sorbet-runtime (~> 0.5)
6
+ tinygql (~> 0.1.4)
7
+ zeitwerk (~> 2.6)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ast (2.4.2)
13
+ base64 (0.1.1)
14
+ bluejay (0.1.0.alpha.2-arm64-darwin)
15
+ sorbet-runtime
16
+ bluejay (0.1.0.alpha.2-x86_64-darwin)
17
+ sorbet-runtime
18
+ diff-lcs (1.5.0)
19
+ erubi (1.12.0)
20
+ json (2.6.3)
21
+ language_server-protocol (3.17.0.3)
22
+ minitest (5.19.0)
23
+ netrc (0.11.0)
24
+ parallel (1.23.0)
25
+ parser (3.2.2.3)
26
+ ast (~> 2.4.1)
27
+ racc
28
+ prettier_print (1.2.1)
29
+ racc (1.7.1)
30
+ rainbow (3.1.1)
31
+ rake (13.0.6)
32
+ rbi (0.0.17)
33
+ ast
34
+ parser (>= 3.0.0)
35
+ sorbet-runtime (>= 0.5.9204)
36
+ unparser (>= 0.5.6)
37
+ regexp_parser (2.8.1)
38
+ rexml (3.2.6)
39
+ rubocop (1.56.1)
40
+ base64 (~> 0.1.1)
41
+ json (~> 2.3)
42
+ language_server-protocol (>= 3.17.0)
43
+ parallel (~> 1.10)
44
+ parser (>= 3.2.2.3)
45
+ rainbow (>= 2.2.2, < 4.0)
46
+ regexp_parser (>= 1.8, < 3.0)
47
+ rexml (>= 3.2.5, < 4.0)
48
+ rubocop-ast (>= 1.28.1, < 2.0)
49
+ ruby-progressbar (~> 1.7)
50
+ unicode-display_width (>= 2.4.0, < 3.0)
51
+ rubocop-ast (1.29.0)
52
+ parser (>= 3.2.1.0)
53
+ rubocop-minitest (0.27.0)
54
+ rubocop (>= 0.90, < 2.0)
55
+ rubocop-rake (0.6.0)
56
+ rubocop (~> 1.0)
57
+ rubocop-shopify (2.14.0)
58
+ rubocop (~> 1.51)
59
+ rubocop-sorbet (0.6.11)
60
+ rubocop (>= 0.90.0)
61
+ ruby-lsp (0.4.5)
62
+ language_server-protocol (~> 3.17.0)
63
+ sorbet-runtime
64
+ syntax_tree (>= 6.1.1, < 7)
65
+ ruby-progressbar (1.13.0)
66
+ sorbet (0.5.10987)
67
+ sorbet-static (= 0.5.10987)
68
+ sorbet-runtime (0.5.10987)
69
+ sorbet-static (0.5.10987-universal-darwin-22)
70
+ sorbet-static-and-runtime (0.5.10987)
71
+ sorbet (= 0.5.10987)
72
+ sorbet-runtime (= 0.5.10987)
73
+ spoom (1.2.3)
74
+ erubi (>= 1.10.0)
75
+ sorbet-static-and-runtime (>= 0.5.10187)
76
+ syntax_tree (>= 6.1.1)
77
+ thor (>= 0.19.2)
78
+ syntax_tree (6.1.1)
79
+ prettier_print (>= 1.2.0)
80
+ tapioca (0.11.8)
81
+ bundler (>= 2.2.25)
82
+ netrc (>= 0.11.0)
83
+ parallel (>= 1.21.0)
84
+ rbi (~> 0.0.0, >= 0.0.16)
85
+ sorbet-static-and-runtime (>= 0.5.10187)
86
+ spoom (~> 1.2.0, >= 1.2.0)
87
+ thor (>= 1.2.0)
88
+ yard-sorbet
89
+ thor (1.2.2)
90
+ tinygql (0.1.4)
91
+ unicode-display_width (2.4.2)
92
+ unparser (0.6.8)
93
+ diff-lcs (~> 1.3)
94
+ parser (>= 3.2.0)
95
+ yard (0.9.34)
96
+ yard-sorbet (0.8.1)
97
+ sorbet-runtime (>= 0.5)
98
+ yard (>= 0.9)
99
+ zeitwerk (2.6.11)
100
+
101
+ PLATFORMS
102
+ arm64-darwin-22
103
+ x86_64-darwin-22
104
+
105
+ DEPENDENCIES
106
+ bluejay (~> 0.1.0.alpha.2)
107
+ bundler (~> 2.4.10)
108
+ minitest (~> 5.0)
109
+ oriole!
110
+ rake (~> 13.0)
111
+ rubocop (~> 1.21)
112
+ rubocop-minitest (~> 0.27.0)
113
+ rubocop-rake (~> 0.6.0)
114
+ rubocop-shopify (~> 2.12)
115
+ rubocop-sorbet (~> 0.6.11)
116
+ ruby-lsp (~> 0.4.0)
117
+ sorbet (~> 0.5)
118
+ tapioca
119
+
120
+ BUNDLED WITH
121
+ 2.4.10
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Adam Petro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # `oriole`
2
+
3
+ > **Warning**
4
+ > This is very scrappy and incomplete
5
+
6
+ ## Benchmark
7
+
8
+ <!---benchmark result start-->
9
+ <details>
10
+ <summary>Parse + Execute (Ruby 3.2, YJIT enabled)</summary>
11
+
12
+ ```
13
+ Profiling IPS:
14
+ Warming up --------------------------------------
15
+ oriole_visibility 362.000 i/100ms
16
+ oriole_no_visibility 488.000 i/100ms
17
+ bluejay 1.766k i/100ms
18
+ Calculating -------------------------------------
19
+ oriole_visibility 3.682k (± 2.3%) i/s - 18.462k in 5.017324s
20
+ oriole_no_visibility 4.992k (± 1.3%) i/s - 25.376k in 5.083988s
21
+ bluejay 18.240k (± 3.1%) i/s - 91.832k in 5.039693s
22
+
23
+ Comparison:
24
+ bluejay: 18239.9 i/s
25
+ oriole_no_visibility: 4992.3 i/s - 3.65x slower
26
+ oriole_visibility: 3681.7 i/s - 4.95x slower
27
+
28
+ Profiling Ruby memory allocations:
29
+ Calculating -------------------------------------
30
+ oriole_visibility 22.648k memsize ( 120.000 retained)
31
+ 264.000 objects ( 2.000 retained)
32
+ 15.000 strings ( 0.000 retained)
33
+ oriole_no_visibility 12.656k memsize ( 4.000k retained)
34
+ 166.000 objects ( 56.000 retained)
35
+ 14.000 strings ( 12.000 retained)
36
+ bluejay 5.256k memsize ( 5.056k retained)
37
+ 40.000 objects ( 35.000 retained)
38
+ 0.000 strings ( 0.000 retained)
39
+
40
+ Comparison:
41
+ bluejay: 5256 allocated
42
+ oriole_no_visibility: 12656 allocated - 2.41x more
43
+ oriole_visibility: 22648 allocated - 4.31x more
44
+ ```
45
+ </details>
46
+
47
+ <details>
48
+ <summary>Parse + Execute (Ruby 3.2, YJIT disabled)</summary>
49
+
50
+ ```
51
+ Profiling IPS:
52
+ Warming up --------------------------------------
53
+ oriole_visibility 234.000 i/100ms
54
+ oriole_no_visibility 323.000 i/100ms
55
+ bluejay 1.804k i/100ms
56
+ Calculating -------------------------------------
57
+ oriole_visibility 2.403k (± 3.3%) i/s - 12.168k in 5.069266s
58
+ oriole_no_visibility 3.274k (± 1.9%) i/s - 16.473k in 5.033067s
59
+ bluejay 18.418k (± 2.1%) i/s - 93.808k in 5.095735s
60
+
61
+ Comparison:
62
+ bluejay: 18417.7 i/s
63
+ oriole_no_visibility: 3274.2 i/s - 5.63x slower
64
+ oriole_visibility: 2403.1 i/s - 7.66x slower
65
+
66
+ Profiling Ruby memory allocations:
67
+ Calculating -------------------------------------
68
+ oriole_visibility 22.648k memsize ( 7.680k retained)
69
+ 264.000 objects ( 104.000 retained)
70
+ 15.000 strings ( 12.000 retained)
71
+ oriole_no_visibility 12.656k memsize ( 4.960k retained)
72
+ 166.000 objects ( 63.000 retained)
73
+ 14.000 strings ( 12.000 retained)
74
+ bluejay 5.256k memsize ( 5.056k retained)
75
+ 40.000 objects ( 35.000 retained)
76
+ 0.000 strings ( 0.000 retained)
77
+
78
+ Comparison:
79
+ bluejay: 5256 allocated
80
+ oriole_no_visibility: 12656 allocated - 2.41x more
81
+ oriole_visibility: 22648 allocated - 4.31x more
82
+ ```
83
+ </details>
84
+ <!---benchmark result end-->
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
data/bench/bench.rb ADDED
@@ -0,0 +1,35 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require "benchmark/ips"
5
+ require "benchmark/memory"
6
+ require "sorbet-runtime"
7
+
8
+ T::Configuration.default_checked_level = :never
9
+
10
+ require "oriole"
11
+
12
+ module Bench
13
+ extend(self)
14
+
15
+ def ips(&blk)
16
+ Benchmark.ips do |x|
17
+ blk.call(x)
18
+
19
+ x.config(time: 0, warmup: 0) if ENV["CI"]
20
+ end
21
+ end
22
+
23
+ def memory(&blk)
24
+ Benchmark.memory do |x|
25
+ blk.call(x)
26
+ end
27
+ end
28
+
29
+ def all(&blk)
30
+ puts "Profiling IPS:"
31
+ ips(&blk)
32
+ puts "Profiling Ruby memory allocations:"
33
+ memory(&blk)
34
+ end
35
+ end
data/bench/execute.rb ADDED
@@ -0,0 +1,66 @@
1
+ # typed: ignore
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "bench"
5
+ require_relative "schemas/bluejay"
6
+ require_relative "schemas/oriole"
7
+ require_relative "schemas/models"
8
+
9
+ Bench.all do |x|
10
+ root_value = Schemas::Models::QueryRoot.new(teams: Schemas::Models::Team.all)
11
+ schema_root_value = Schemas::Models::SchemaRoot.new(query: root_value)
12
+ query = <<~GQL
13
+ {
14
+ teams {
15
+ __typename
16
+ name
17
+ city
18
+ players {
19
+ __typename
20
+ firstName
21
+ lastName
22
+ age
23
+ draftPosition { __typename round selection year }
24
+ }
25
+ }
26
+ }
27
+ GQL
28
+
29
+ oriole_visibility_test_run = Schemas::Oriole::Schema.execute(query:, root_value:, context: nil)
30
+ oriole_no_visibility_test_run = Oriole::Execution::Engine.execute(
31
+ schema_definition: Schemas::Oriole::Schema,
32
+ query:,
33
+ context: nil,
34
+ operation_name: nil,
35
+ root_value:,
36
+ )
37
+ bluejay_test_run = Schemas::Bluejay::Schema.execute(query:, operation_name: nil, initial_value: schema_root_value)
38
+
39
+ unless bluejay_test_run.errors.empty?
40
+ raise "errors returned"
41
+ end
42
+
43
+ unless oriole_visibility_test_run == bluejay_test_run.value && oriole_no_visibility_test_run == bluejay_test_run.value
44
+ raise "results not equal"
45
+ end
46
+
47
+ x.report(:oriole_visibility) do
48
+ Schemas::Oriole::Schema.execute(query:, root_value:, context: nil)
49
+ end
50
+
51
+ x.report(:oriole_no_visibility) do
52
+ Oriole::Execution::Engine.execute(
53
+ schema_definition: Schemas::Oriole::Schema,
54
+ query:,
55
+ context: nil,
56
+ operation_name: nil,
57
+ root_value:,
58
+ )
59
+ end
60
+
61
+ x.report(:bluejay) do
62
+ Schemas::Bluejay::Schema.execute(query:, operation_name: nil, initial_value: schema_root_value)
63
+ end
64
+
65
+ x.compare!
66
+ end
@@ -0,0 +1,149 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require "bluejay"
5
+
6
+ module Schemas
7
+ module Bluejay
8
+ class DraftPosition < ::Bluejay::ObjectType
9
+ class << self
10
+ extend(T::Sig)
11
+
12
+ sig { override.returns(T::Array[::Bluejay::FieldDefinition]) }
13
+ def field_definitions
14
+ [
15
+ ::Bluejay::FieldDefinition.new(name: "round", type: ot!(::Bluejay::Scalar::Int)),
16
+ ::Bluejay::FieldDefinition.new(name: "selection", type: ot!(::Bluejay::Scalar::Int)),
17
+ ::Bluejay::FieldDefinition.new(name: "year", type: ot!(::Bluejay::Scalar::Int)),
18
+ ]
19
+ end
20
+ end
21
+ end
22
+
23
+ class Player < ::Bluejay::ObjectType
24
+ class << self
25
+ extend(T::Sig)
26
+
27
+ sig { override.returns(T::Array[::Bluejay::FieldDefinition]) }
28
+ def field_definitions
29
+ [
30
+ ::Bluejay::FieldDefinition.new(name: "firstName", type: ot!(::Bluejay::Scalar::String)),
31
+ ::Bluejay::FieldDefinition.new(name: "lastName", type: ot!(::Bluejay::Scalar::String)),
32
+ ::Bluejay::FieldDefinition.new(name: "age", type: ot!(::Bluejay::Scalar::Int)),
33
+ ::Bluejay::FieldDefinition.new(name: "draftPosition", type: ot(DraftPosition)),
34
+ ]
35
+ end
36
+ end
37
+ end
38
+
39
+ class Team < ::Bluejay::ObjectType
40
+ class << self
41
+ extend(T::Sig)
42
+
43
+ sig { override.returns(T::Array[::Bluejay::FieldDefinition]) }
44
+ def field_definitions
45
+ [
46
+ ::Bluejay::FieldDefinition.new(name: "name", type: ot!(::Bluejay::Scalar::String)),
47
+ ::Bluejay::FieldDefinition.new(name: "city", type: ot!(::Bluejay::Scalar::String)),
48
+ ::Bluejay::FieldDefinition.new(name: "players", type: lot!(ot!(Player))),
49
+ ]
50
+ end
51
+ end
52
+ end
53
+
54
+ class QueryRoot < ::Bluejay::QueryRoot
55
+ class << self
56
+ extend(T::Sig)
57
+
58
+ sig { override.returns(T::Array[::Bluejay::FieldDefinition]) }
59
+ def field_definitions
60
+ [
61
+ ::Bluejay::FieldDefinition.new(name: "teams", type: lot!(ot!(Team))),
62
+ ]
63
+ end
64
+ end
65
+ end
66
+
67
+ class DraftPositionInput < ::Bluejay::InputObjectType
68
+ class << self
69
+ extend(T::Sig)
70
+
71
+ sig { override.returns(T::Array[::Bluejay::InputValueDefinition]) }
72
+ def input_field_definitions
73
+ [
74
+ ::Bluejay::InputValueDefinition.new(name: "round", type: it!(::Bluejay::Scalar::Int)),
75
+ ::Bluejay::InputValueDefinition.new(name: "selection", type: it!(::Bluejay::Scalar::Int)),
76
+ ::Bluejay::InputValueDefinition.new(name: "year", type: it!(::Bluejay::Scalar::Int)),
77
+ ]
78
+ end
79
+ end
80
+ end
81
+
82
+ class PlayerInput < ::Bluejay::InputObjectType
83
+ class << self
84
+ extend(T::Sig)
85
+
86
+ sig { override.returns(T::Array[::Bluejay::InputValueDefinition]) }
87
+ def input_field_definitions
88
+ [
89
+ ::Bluejay::InputValueDefinition.new(name: "firstName", type: it!(::Bluejay::Scalar::String)),
90
+ ::Bluejay::InputValueDefinition.new(name: "lastName", type: it!(::Bluejay::Scalar::String)),
91
+ ::Bluejay::InputValueDefinition.new(name: "age", type: it!(::Bluejay::Scalar::Int)),
92
+ ::Bluejay::InputValueDefinition.new(name: "draftPosition", type: it(DraftPositionInput)),
93
+ ]
94
+ end
95
+ end
96
+ end
97
+
98
+ class PlayersCreate < ::Bluejay::ObjectType
99
+ class << self
100
+ extend(T::Sig)
101
+
102
+ sig { override.returns(T::Array[::Bluejay::FieldDefinition]) }
103
+ def field_definitions
104
+ [
105
+ ::Bluejay::FieldDefinition.new(name: "count", type: ot!(::Bluejay::Scalar::Int)),
106
+ ]
107
+ end
108
+ end
109
+ end
110
+
111
+ class MutationRoot < ::Bluejay::ObjectType
112
+ class << self
113
+ extend(T::Sig)
114
+
115
+ sig { override.returns(T::Array[::Bluejay::FieldDefinition]) }
116
+ def field_definitions
117
+ [
118
+ ::Bluejay::FieldDefinition.new(
119
+ name: "playersCreate",
120
+ argument_definitions: [
121
+ ::Bluejay::InputValueDefinition.new(
122
+ name: "players",
123
+ type: lit!(it!(PlayerInput)),
124
+ ),
125
+ ],
126
+ type: ot!(PlayersCreate),
127
+ ),
128
+ ]
129
+ end
130
+ end
131
+ end
132
+
133
+ class Schema < ::Bluejay::Schema
134
+ class << self
135
+ extend(T::Sig)
136
+
137
+ sig { override.returns(T.class_of(::Bluejay::QueryRoot)) }
138
+ def query
139
+ QueryRoot
140
+ end
141
+
142
+ sig { override.returns(T.nilable(T.class_of(::Bluejay::ObjectType))) }
143
+ def mutation
144
+ MutationRoot
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end