grape_sorbet 0.1.3 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +38 -43
- data/README.md +1 -1
- data/grape_sorbet.gemspec +1 -1
- data/lib/grape_sorbet/version.rb +1 -1
- data/lib/tapioca/dsl/compilers/grape_endpoints.rb +25 -15
- data/rbi/grape.rbi +49 -31
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45af83b12e78e09b03afa878030c584470b187fd67d5dc88722be2a0eaab38ee
|
|
4
|
+
data.tar.gz: b9a819db7cb9c3d122677c0d365e4db21b22099def374e5c196fb014d092bd31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 07b28d5b8dea5d7f2687cbf73dbfe2e4c0b224ab7c654604662a69762eb93d5a0ded9377e9c4a64cec9d7f013a8c333b7e9c1fb830d2e19f67f010bee2b93728
|
|
7
|
+
data.tar.gz: 7a02866836b892f458f72c6b47aa5f4c108c76199c7343af1ed35e255eec50c13222e80f2464237b7feb269ca5dbbaf4497924e4565529b180815f7d3a669e88
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 0.2.0 (2026-06-30)
|
|
2
|
+
|
|
3
|
+
⚠️ This release is a BREAKING CHANGE. ⚠️
|
|
4
|
+
|
|
5
|
+
grape_sorbet now targets grape >= 3.3 and is no longer compatible with older grape versions.
|
|
6
|
+
|
|
7
|
+
- Update signatures for grape 3.3 (#61)
|
|
8
|
+
|
|
1
9
|
## 0.1.3 (2026-05-26)
|
|
2
10
|
|
|
3
11
|
- Fix endpoint compiler to respect API superclass (#44)
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
grape_sorbet (0.
|
|
4
|
+
grape_sorbet (0.2.0)
|
|
5
5
|
activesupport
|
|
6
|
-
grape (~> 3.
|
|
6
|
+
grape (~> 3.3)
|
|
7
7
|
sorbet-runtime (>= 0.6)
|
|
8
8
|
|
|
9
9
|
GEM
|
|
@@ -31,7 +31,7 @@ GEM
|
|
|
31
31
|
bundler-audit (0.9.3)
|
|
32
32
|
bundler (>= 1.2.0)
|
|
33
33
|
thor (~> 1.0)
|
|
34
|
-
concurrent-ruby (1.3.
|
|
34
|
+
concurrent-ruby (1.3.7)
|
|
35
35
|
connection_pool (3.0.2)
|
|
36
36
|
date (3.5.1)
|
|
37
37
|
docile (1.4.1)
|
|
@@ -58,17 +58,16 @@ GEM
|
|
|
58
58
|
zeitwerk (~> 2.6)
|
|
59
59
|
erb (6.0.4)
|
|
60
60
|
erubi (1.13.1)
|
|
61
|
-
grape (3.
|
|
61
|
+
grape (3.3.1)
|
|
62
62
|
activesupport (>= 7.2)
|
|
63
|
-
dry-configurable
|
|
63
|
+
dry-configurable (>= 1.0)
|
|
64
64
|
dry-types (>= 1.1)
|
|
65
|
-
mustermann
|
|
66
|
-
rack (>= 2)
|
|
67
|
-
zeitwerk
|
|
68
|
-
grape-entity (1.0
|
|
65
|
+
mustermann (>= 4.0)
|
|
66
|
+
rack (>= 2.2.4)
|
|
67
|
+
zeitwerk (>= 2.6)
|
|
68
|
+
grape-entity (1.1.0)
|
|
69
69
|
activesupport (>= 3.0.0)
|
|
70
|
-
|
|
71
|
-
i18n (1.14.8)
|
|
70
|
+
i18n (1.15.2)
|
|
72
71
|
concurrent-ruby (~> 1.0)
|
|
73
72
|
io-console (0.8.2)
|
|
74
73
|
irb (1.18.0)
|
|
@@ -76,7 +75,7 @@ GEM
|
|
|
76
75
|
prism (>= 1.3.0)
|
|
77
76
|
rdoc (>= 4.0.0)
|
|
78
77
|
reline (>= 0.4.2)
|
|
79
|
-
json (2.
|
|
78
|
+
json (2.20.0)
|
|
80
79
|
language_server-protocol (3.17.0.5)
|
|
81
80
|
lint_roller (1.1.0)
|
|
82
81
|
logger (1.7.0)
|
|
@@ -88,10 +87,7 @@ GEM
|
|
|
88
87
|
builder
|
|
89
88
|
minitest (>= 5.0, < 7)
|
|
90
89
|
ruby-progressbar
|
|
91
|
-
multi_json (1.21.1)
|
|
92
90
|
mustermann (4.0.0)
|
|
93
|
-
mustermann-grape (1.1.0)
|
|
94
|
-
mustermann (>= 1.0.0)
|
|
95
91
|
netrc (0.11.0)
|
|
96
92
|
parallel (2.1.0)
|
|
97
93
|
parser (3.3.11.1)
|
|
@@ -124,7 +120,7 @@ GEM
|
|
|
124
120
|
io-console (~> 0.5)
|
|
125
121
|
require-hooks (0.4.0)
|
|
126
122
|
rexml (3.4.4)
|
|
127
|
-
rubocop (1.
|
|
123
|
+
rubocop (1.88.0)
|
|
128
124
|
json (~> 2.3)
|
|
129
125
|
language_server-protocol (~> 3.17.0.2)
|
|
130
126
|
lint_roller (~> 1.1.0)
|
|
@@ -166,15 +162,15 @@ GEM
|
|
|
166
162
|
simplecov_json_formatter (~> 0.1)
|
|
167
163
|
simplecov-html (0.13.2)
|
|
168
164
|
simplecov_json_formatter (0.1.4)
|
|
169
|
-
sorbet (0.6.
|
|
170
|
-
sorbet-static (= 0.6.
|
|
171
|
-
sorbet-runtime (0.6.
|
|
172
|
-
sorbet-static (0.6.
|
|
173
|
-
sorbet-static (0.6.
|
|
174
|
-
sorbet-static (0.6.
|
|
175
|
-
sorbet-static-and-runtime (0.6.
|
|
176
|
-
sorbet (= 0.6.
|
|
177
|
-
sorbet-runtime (= 0.6.
|
|
165
|
+
sorbet (0.6.13308)
|
|
166
|
+
sorbet-static (= 0.6.13308)
|
|
167
|
+
sorbet-runtime (0.6.13308)
|
|
168
|
+
sorbet-static (0.6.13308-aarch64-linux)
|
|
169
|
+
sorbet-static (0.6.13308-universal-darwin)
|
|
170
|
+
sorbet-static (0.6.13308-x86_64-linux)
|
|
171
|
+
sorbet-static-and-runtime (0.6.13308)
|
|
172
|
+
sorbet (= 0.6.13308)
|
|
173
|
+
sorbet-runtime (= 0.6.13308)
|
|
178
174
|
spoom (1.7.14)
|
|
179
175
|
erubi (>= 1.10.0)
|
|
180
176
|
prism (>= 0.28.0)
|
|
@@ -204,7 +200,7 @@ GEM
|
|
|
204
200
|
unicode-emoji (~> 4.1)
|
|
205
201
|
unicode-emoji (4.2.0)
|
|
206
202
|
uri (1.1.1)
|
|
207
|
-
zeitwerk (2.
|
|
203
|
+
zeitwerk (2.8.2)
|
|
208
204
|
|
|
209
205
|
PLATFORMS
|
|
210
206
|
aarch64-linux
|
|
@@ -239,8 +235,9 @@ CHECKSUMS
|
|
|
239
235
|
benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c
|
|
240
236
|
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
241
237
|
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
|
|
238
|
+
bundler (4.0.15) sha256=a4ceb882fe94a0e0ac63cd0813932bbfd631a14e5ac0b7975189b19a4d28d9e7
|
|
242
239
|
bundler-audit (0.9.3) sha256=81c8766c71e47d0d28a0f98c7eed028539f21a6ea3cd8f685eb6f42333c9b4e9
|
|
243
|
-
concurrent-ruby (1.3.
|
|
240
|
+
concurrent-ruby (1.3.7) sha256=4412caec3a5ea2e5fdc52076724c071a81f2c0593d83b2ac8cbb8ca63b3151b0
|
|
244
241
|
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
245
242
|
date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
|
|
246
243
|
docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
|
|
@@ -252,21 +249,19 @@ CHECKSUMS
|
|
|
252
249
|
dry-types (1.9.1) sha256=baebeecdb9f8395d6c9d227b62011279440943e3ef2468fe8ccc1ba11467f178
|
|
253
250
|
erb (6.0.4) sha256=38e3803694be357fe2bfe312487c74beaf9fb4e5beb3e22498952fe1645b95d9
|
|
254
251
|
erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
|
|
255
|
-
grape (3.
|
|
256
|
-
grape-entity (1.0
|
|
257
|
-
grape_sorbet (0.
|
|
258
|
-
i18n (1.
|
|
252
|
+
grape (3.3.1) sha256=e723e52576e4394c1c9fbf7af59d4fd1b048311eaf824a2a525d838398f244bf
|
|
253
|
+
grape-entity (1.1.0) sha256=ab6a1004e57791834e8497d5e85a3c101b72144d8ca31462a26e6d0a380c3d89
|
|
254
|
+
grape_sorbet (0.2.0)
|
|
255
|
+
i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
|
|
259
256
|
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
|
|
260
257
|
irb (1.18.0) sha256=de9454a0703a54704b9811a5ef31a60c86949fbf4013fcf244fabc7c775248e3
|
|
261
|
-
json (2.
|
|
258
|
+
json (2.20.0) sha256=9362bc6e55a952b056abf9167cf053358181c904cb70cd6eee0808ea830fc32b
|
|
262
259
|
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
263
260
|
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
264
261
|
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
265
262
|
minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
|
|
266
263
|
minitest-reporters (1.8.0) sha256=8ce5280fb73ad3178ae525454df169b6f28c1b38b1d088ea91815d3a370ba384
|
|
267
|
-
multi_json (1.21.1) sha256=e6126a31808e3b4d19f483c775ceac34df190dffa62adfb63a165ee14ba68080
|
|
268
264
|
mustermann (4.0.0) sha256=91f67411bb208d1d93c41e6128cb3b0f8ddd9ec7c45966f1007e1c43c08040d7
|
|
269
|
-
mustermann-grape (1.1.0) sha256=8d258a986004c8f01ce4c023c0b037c168a9ed889cf5778068ad54398fa458c5
|
|
270
265
|
netrc (0.11.0) sha256=de1ce33da8c99ab1d97871726cba75151113f117146becbe45aa85cb3dabee3f
|
|
271
266
|
parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
|
|
272
267
|
parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
|
|
@@ -285,7 +280,7 @@ CHECKSUMS
|
|
|
285
280
|
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
|
|
286
281
|
require-hooks (0.4.0) sha256=005f4c6435b4edae73e358cdbaba48370a4121f9ce893d5d2a3c66fce855677d
|
|
287
282
|
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
|
|
288
|
-
rubocop (1.
|
|
283
|
+
rubocop (1.88.0) sha256=e420ddf1662d0ef34bc8a2910ac4b396a7ddda0b51a708264405241734b08e0b
|
|
289
284
|
rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
|
|
290
285
|
rubocop-minitest (0.39.1) sha256=998398d6da4026d297f0f9bf709a1eac5f2b6947c24431f94af08138510cf7ed
|
|
291
286
|
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
|
|
@@ -301,12 +296,12 @@ CHECKSUMS
|
|
|
301
296
|
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
|
|
302
297
|
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
|
|
303
298
|
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
|
|
304
|
-
sorbet (0.6.
|
|
305
|
-
sorbet-runtime (0.6.
|
|
306
|
-
sorbet-static (0.6.
|
|
307
|
-
sorbet-static (0.6.
|
|
308
|
-
sorbet-static (0.6.
|
|
309
|
-
sorbet-static-and-runtime (0.6.
|
|
299
|
+
sorbet (0.6.13308) sha256=9cc91ea7fb6c90802a1f35567888e36b4b479f11c673caaa31e4a18b2af63ae6
|
|
300
|
+
sorbet-runtime (0.6.13308) sha256=71d772cc345bcf38fb7dce78397ebd6c061fd531aa71d222f379f34f8930fe7a
|
|
301
|
+
sorbet-static (0.6.13308-aarch64-linux) sha256=eeed1160b9dc1329e2e79b98286b74ef79bab3f1283ba95ebb39d45affb4cbf5
|
|
302
|
+
sorbet-static (0.6.13308-universal-darwin) sha256=0acc34dfdde8fd7215dfdfcf7445ad0a28b707acaac487784bc9e1a69d90f4dd
|
|
303
|
+
sorbet-static (0.6.13308-x86_64-linux) sha256=4e5491f999cc556a5fa71996fc5fd2be36172d2b45c57d3a9c7b69650e8cf2e4
|
|
304
|
+
sorbet-static-and-runtime (0.6.13308) sha256=a01f2c7817c0800858b59b3a07b3b63d29245e5a185d4790d7bab9f3f3faa39e
|
|
310
305
|
spoom (1.7.14) sha256=48da4e39d9a63611aa0132a3656d7e75833fcccb6006d59f7fa879b98c8877c4
|
|
311
306
|
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
|
|
312
307
|
tapioca (0.19.1) sha256=5de94d458950897ffe3d4e86a21eec48bb6a8775af85f80b1486b7ae7ba51823
|
|
@@ -316,7 +311,7 @@ CHECKSUMS
|
|
|
316
311
|
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
317
312
|
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
318
313
|
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
|
|
319
|
-
zeitwerk (2.
|
|
314
|
+
zeitwerk (2.8.2) sha256=7212a61311083c604184b1ea2574b9aa05cd14f855a0841c06985cabe9181d12
|
|
320
315
|
|
|
321
316
|
BUNDLED WITH
|
|
322
|
-
4.0.
|
|
317
|
+
4.0.15
|
data/README.md
CHANGED
data/grape_sorbet.gemspec
CHANGED
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
|
|
33
33
|
# Uncomment to register a new dependency of your gem
|
|
34
34
|
spec.add_dependency("activesupport")
|
|
35
|
-
spec.add_dependency("grape", "~> 3.
|
|
35
|
+
spec.add_dependency("grape", "~> 3.3")
|
|
36
36
|
spec.add_dependency("sorbet-runtime", ">= 0.6")
|
|
37
37
|
|
|
38
38
|
# For more information and examples about making a new gem, check out our
|
data/lib/grape_sorbet/version.rb
CHANGED
|
@@ -97,19 +97,19 @@ module Tapioca
|
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
100
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/callbacks.rb#L12-L22
|
|
101
101
|
CALLBACKS_METHODS = T.let(
|
|
102
102
|
[:before, :before_validation, :after_validation, :after, :finally].freeze,
|
|
103
103
|
T::Array[Symbol],
|
|
104
104
|
)
|
|
105
105
|
|
|
106
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
106
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape.rb#L56-L64
|
|
107
107
|
HTTP_VERB_METHODS = T.let(
|
|
108
108
|
[:get, :post, :put, :patch, :delete, :head, :options].freeze,
|
|
109
109
|
T::Array[Symbol],
|
|
110
110
|
)
|
|
111
111
|
|
|
112
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
112
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L209-L234
|
|
113
113
|
NAMESPACE_METHODS = T.let(
|
|
114
114
|
[:namespace, :group, :resource, :resources, :segment].freeze,
|
|
115
115
|
T::Array[Symbol],
|
|
@@ -153,7 +153,7 @@ module Tapioca
|
|
|
153
153
|
sig { params(api: RBI::Scope).void }
|
|
154
154
|
def create_callbacks_methods(api)
|
|
155
155
|
api.create_module(CallbacksMethodsModuleName) do |mod|
|
|
156
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
156
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/callbacks.rb#L12-L22
|
|
157
157
|
CALLBACKS_METHODS.each do |callback|
|
|
158
158
|
mod.create_method(
|
|
159
159
|
callback.to_s,
|
|
@@ -169,22 +169,32 @@ module Tapioca
|
|
|
169
169
|
sig { params(api: RBI::Scope).void }
|
|
170
170
|
def create_request_response_methods(api)
|
|
171
171
|
api.create_module(RequestResponseMethodsModuleName) do |mod|
|
|
172
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
172
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/request_response.rb#L85-L128
|
|
173
173
|
mod.create_method("rescue_from") do |method|
|
|
174
174
|
method.add_rest_param("args")
|
|
175
|
-
method.
|
|
175
|
+
method.add_kw_opt_param("with", "nil")
|
|
176
|
+
method.add_kw_opt_param("rescue_subclasses", "true")
|
|
177
|
+
method.add_kw_opt_param("backtrace", "false")
|
|
178
|
+
method.add_kw_opt_param("original_exception", "false")
|
|
176
179
|
method.add_block_param("block")
|
|
177
180
|
|
|
178
181
|
method.add_sig do |sig|
|
|
179
182
|
sig.add_param("args", "Symbol")
|
|
180
183
|
# Sorbet doesn't support keyword arguments in overloaded functions :(
|
|
181
|
-
# sig.add_param("
|
|
184
|
+
# sig.add_param("with", "T.untyped")
|
|
185
|
+
# sig.add_param("rescue_subclasses", "T::Boolean")
|
|
186
|
+
# sig.add_param("backtrace", "T::Boolean")
|
|
187
|
+
# sig.add_param("original_exception", "T::Boolean")
|
|
182
188
|
sig.add_param("block", "T.nilable(T.proc.bind(#{EndpointClassName}).params(e: Exception).void)")
|
|
183
189
|
sig.return_type = "void"
|
|
184
190
|
end
|
|
191
|
+
|
|
185
192
|
method.add_sig(type_params: ["E"]) do |sig|
|
|
186
193
|
sig.add_param("args", "T::Class[T.all(::Exception, T.type_parameter(:E))]")
|
|
187
|
-
sig.add_param("
|
|
194
|
+
sig.add_param("with", "T.untyped")
|
|
195
|
+
sig.add_param("rescue_subclasses", "T::Boolean")
|
|
196
|
+
sig.add_param("backtrace", "T::Boolean")
|
|
197
|
+
sig.add_param("original_exception", "T::Boolean")
|
|
188
198
|
sig.add_param(
|
|
189
199
|
"block",
|
|
190
200
|
"T.nilable(T.proc.bind(#{EndpointClassName}).params(e: T.type_parameter(:E)).void)",
|
|
@@ -198,24 +208,24 @@ module Tapioca
|
|
|
198
208
|
sig { params(api: RBI::Scope).void }
|
|
199
209
|
def create_routing_methods(api)
|
|
200
210
|
api.create_module(RoutingMethodsModuleName) do |routing_methods_module|
|
|
201
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
211
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L169-L201
|
|
202
212
|
routing_methods_module.create_method(
|
|
203
213
|
"route",
|
|
204
214
|
parameters: [
|
|
205
|
-
create_param("methods", type: "T.
|
|
206
|
-
create_opt_param("paths", type: "T.
|
|
215
|
+
create_param("methods", type: "T.any(Symbol, String, T::Array[String])"),
|
|
216
|
+
create_opt_param("paths", type: "T.nilable(T.any(String, T::Array[String]))", default: "['/']"),
|
|
207
217
|
create_opt_param("route_options", type: "T::Hash[Symbol, T.untyped]", default: "{}"),
|
|
208
218
|
create_block_param("block", type: "T.nilable(T.proc.bind(#{EndpointClassName}).void)"),
|
|
209
219
|
],
|
|
210
220
|
return_type: "void",
|
|
211
221
|
)
|
|
212
222
|
|
|
213
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
223
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L203-L207
|
|
214
224
|
HTTP_VERB_METHODS.each do |verb|
|
|
215
225
|
routing_methods_module.create_method(
|
|
216
226
|
verb.to_s,
|
|
217
227
|
parameters: [
|
|
218
|
-
|
|
228
|
+
create_opt_param("path", type: "String", default: "'/'"),
|
|
219
229
|
create_kw_rest_param("options", type: "T.untyped"),
|
|
220
230
|
create_block_param("block", type: "T.nilable(T.proc.bind(#{EndpointClassName}).void)"),
|
|
221
231
|
],
|
|
@@ -223,7 +233,7 @@ module Tapioca
|
|
|
223
233
|
)
|
|
224
234
|
end
|
|
225
235
|
|
|
226
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
236
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L209-L234
|
|
227
237
|
NAMESPACE_METHODS.each do |namespace_method|
|
|
228
238
|
routing_methods_module.create_method(
|
|
229
239
|
namespace_method.to_s,
|
|
@@ -237,7 +247,7 @@ module Tapioca
|
|
|
237
247
|
)
|
|
238
248
|
end
|
|
239
249
|
|
|
240
|
-
# https://github.com/ruby-grape/grape/blob/v3.
|
|
250
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L241-L254
|
|
241
251
|
routing_methods_module.create_method(
|
|
242
252
|
"route_param",
|
|
243
253
|
parameters: [
|
data/rbi/grape.rbi
CHANGED
|
@@ -4,18 +4,21 @@
|
|
|
4
4
|
module Grape
|
|
5
5
|
module DSL
|
|
6
6
|
module Desc
|
|
7
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/desc.rb#L8-L68
|
|
7
8
|
sig do
|
|
8
9
|
params(
|
|
9
10
|
description: String,
|
|
10
|
-
|
|
11
|
+
legacy_options: T.untyped,
|
|
12
|
+
options: T.untyped,
|
|
11
13
|
config_block: T.nilable(T.proc.bind(Grape::Util::ApiDescription).void),
|
|
12
14
|
).void
|
|
13
15
|
end
|
|
14
|
-
def desc(description, options
|
|
16
|
+
def desc(description, *legacy_options, **options, &config_block); end
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
module Helpers
|
|
18
20
|
module BaseHelper
|
|
21
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/helpers.rb#L103-L106
|
|
19
22
|
sig do
|
|
20
23
|
params(
|
|
21
24
|
name: Symbol,
|
|
@@ -25,6 +28,7 @@ module Grape
|
|
|
25
28
|
def params(name, &block); end
|
|
26
29
|
end
|
|
27
30
|
|
|
31
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/helpers.rb#L6-L35
|
|
28
32
|
sig do
|
|
29
33
|
params(
|
|
30
34
|
new_modules: T.untyped,
|
|
@@ -35,6 +39,7 @@ module Grape
|
|
|
35
39
|
end
|
|
36
40
|
|
|
37
41
|
module InsideRoute
|
|
42
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/inside_route.rb#L21-L35
|
|
38
43
|
sig do
|
|
39
44
|
params(
|
|
40
45
|
message: T.any(String, T::Hash[Symbol, T.untyped]),
|
|
@@ -44,98 +49,108 @@ module Grape
|
|
|
44
49
|
original_exception: T.nilable(Exception),
|
|
45
50
|
).returns(T.noreturn)
|
|
46
51
|
end
|
|
47
|
-
def error!(message, status = nil, additional_headers = nil, backtrace = nil, original_exception = nil)
|
|
48
|
-
end
|
|
52
|
+
def error!(message, status = nil, additional_headers = nil, backtrace = nil, original_exception = nil); end
|
|
49
53
|
|
|
54
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/inside_route.rb#L59-L71
|
|
50
55
|
sig { params(status: T.nilable(T.any(Integer, Symbol))).returns(Integer) }
|
|
51
56
|
def status(status = nil); end
|
|
52
57
|
|
|
58
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/inside_route.rb#L158-L168
|
|
53
59
|
sig { returns(Grape::Router::Route) }
|
|
54
60
|
def route; end
|
|
55
61
|
end
|
|
56
62
|
|
|
57
63
|
module RequestResponse
|
|
64
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/request_response.rb#L85-L128
|
|
58
65
|
sig do
|
|
59
66
|
params(
|
|
60
67
|
args: Symbol,
|
|
61
68
|
# Sorbet doesn't support keyword arguments in overloaded functions :(
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
# with: T.untyped,
|
|
70
|
+
# rescue_subclasses: T::Boolean,
|
|
71
|
+
# backtrace: T::Boolean,
|
|
72
|
+
# original_exception: T::Boolean,
|
|
73
|
+
block: T.proc.bind(Grape::Endpoint).params(e: Exception).void,
|
|
74
|
+
)
|
|
75
|
+
.void
|
|
65
76
|
end
|
|
66
77
|
sig do
|
|
67
78
|
type_parameters(:E)
|
|
68
79
|
.params(
|
|
69
80
|
args: T::Class[T.all(Exception, T.type_parameter(:E))],
|
|
70
|
-
|
|
81
|
+
with: T.untyped,
|
|
82
|
+
rescue_subclasses: T::Boolean,
|
|
83
|
+
backtrace: T::Boolean,
|
|
84
|
+
original_exception: T::Boolean,
|
|
71
85
|
block: T.proc.bind(Grape::Endpoint).params(e: T.type_parameter(:E)).void,
|
|
72
86
|
)
|
|
73
87
|
.void
|
|
74
88
|
end
|
|
75
|
-
def rescue_from(*args,
|
|
89
|
+
def rescue_from(*args, with: nil, rescue_subclasses: true, backtrace: false, original_exception: false, &block); end
|
|
76
90
|
end
|
|
77
91
|
|
|
78
92
|
module Routing
|
|
79
|
-
# @shim: https://github.com/ruby-grape/grape/blob/v3.
|
|
93
|
+
# @shim: https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L203-L207
|
|
80
94
|
sig do
|
|
81
95
|
params(
|
|
82
|
-
|
|
96
|
+
path: String,
|
|
83
97
|
options: T.untyped,
|
|
84
98
|
block: T.nilable(T.proc.bind(Grape::Endpoint).void),
|
|
85
99
|
).void
|
|
86
100
|
end
|
|
87
|
-
def delete(
|
|
101
|
+
def delete(path = '/', **options, &block); end
|
|
88
102
|
|
|
89
|
-
# @shim: https://github.com/ruby-grape/grape/blob/v3.
|
|
103
|
+
# @shim: https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L203-L207
|
|
90
104
|
sig do
|
|
91
105
|
params(
|
|
92
|
-
|
|
106
|
+
path: String,
|
|
93
107
|
options: T.untyped,
|
|
94
108
|
block: T.nilable(T.proc.bind(Grape::Endpoint).void),
|
|
95
109
|
).void
|
|
96
110
|
end
|
|
97
|
-
def get(
|
|
111
|
+
def get(path = '/', **options, &block); end
|
|
98
112
|
|
|
99
|
-
# @shim: https://github.com/ruby-grape/grape/blob/v3.
|
|
113
|
+
# @shim: https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L203-L207
|
|
100
114
|
sig do
|
|
101
115
|
params(
|
|
102
|
-
|
|
116
|
+
path: String,
|
|
103
117
|
options: T.untyped,
|
|
104
118
|
block: T.nilable(T.proc.bind(Grape::Endpoint).void),
|
|
105
119
|
).void
|
|
106
120
|
end
|
|
107
|
-
def options(
|
|
121
|
+
def options(path = '/', **options, &block); end
|
|
108
122
|
|
|
109
|
-
# @shim: https://github.com/ruby-grape/grape/blob/v3.
|
|
123
|
+
# @shim: https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L203-L207
|
|
110
124
|
sig do
|
|
111
125
|
params(
|
|
112
|
-
|
|
126
|
+
path: String,
|
|
113
127
|
options: T.untyped,
|
|
114
128
|
block: T.nilable(T.proc.bind(Grape::Endpoint).void),
|
|
115
129
|
).void
|
|
116
130
|
end
|
|
117
|
-
def patch(
|
|
131
|
+
def patch(path = '/', **options, &block); end
|
|
118
132
|
|
|
119
|
-
# @shim: https://github.com/ruby-grape/grape/blob/v3.
|
|
133
|
+
# @shim: https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L203-L207
|
|
120
134
|
sig do
|
|
121
135
|
params(
|
|
122
|
-
|
|
136
|
+
path: String,
|
|
123
137
|
options: T.untyped,
|
|
124
138
|
block: T.nilable(T.proc.bind(Grape::Endpoint).void),
|
|
125
139
|
).void
|
|
126
140
|
end
|
|
127
|
-
def post(
|
|
141
|
+
def post(path = '/', **options, &block); end
|
|
128
142
|
|
|
129
|
-
# @shim: https://github.com/ruby-grape/grape/blob/v3.
|
|
143
|
+
# @shim: https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L203-L207
|
|
130
144
|
sig do
|
|
131
145
|
params(
|
|
132
|
-
|
|
146
|
+
path: String,
|
|
133
147
|
options: T.untyped,
|
|
134
148
|
block: T.nilable(T.proc.bind(Grape::Endpoint).void),
|
|
135
149
|
).void
|
|
136
150
|
end
|
|
137
|
-
def put(
|
|
151
|
+
def put(path = '/', **options, &block); end
|
|
138
152
|
|
|
153
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L169-L201
|
|
139
154
|
sig do
|
|
140
155
|
params(
|
|
141
156
|
methods: T.any(Symbol, String, T::Array[String]),
|
|
@@ -144,27 +159,30 @@ module Grape
|
|
|
144
159
|
block: T.nilable(T.proc.bind(Grape::Endpoint).void),
|
|
145
160
|
).void
|
|
146
161
|
end
|
|
147
|
-
def route(methods, paths = [
|
|
162
|
+
def route(methods, paths = ['/'], route_options = {}, &block); end
|
|
148
163
|
|
|
164
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/routing.rb#L241-L254
|
|
149
165
|
sig do
|
|
150
166
|
params(
|
|
151
167
|
param: Symbol,
|
|
152
168
|
requirements: T.nilable(T::Hash[Symbol, T.untyped]),
|
|
153
169
|
type: T.untyped,
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
options: T.untyped,
|
|
171
|
+
block: T.nilable(T.proc.bind(Grape::Endpoint).void),
|
|
156
172
|
).void
|
|
157
173
|
end
|
|
158
|
-
def route_param(param, requirements: nil, type: nil, **
|
|
174
|
+
def route_param(param, requirements: nil, type: nil, **options, &block); end
|
|
159
175
|
end
|
|
160
176
|
|
|
161
177
|
module Validations
|
|
178
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/dsl/validations.rb#L6-L11
|
|
162
179
|
sig { params(block: T.proc.bind(Grape::Validations::ParamsScope).void).void }
|
|
163
180
|
def params(&block); end
|
|
164
181
|
end
|
|
165
182
|
end
|
|
166
183
|
|
|
167
184
|
class Endpoint
|
|
185
|
+
# https://github.com/ruby-grape/grape/blob/v3.3.1/lib/grape/endpoint.rb#L14
|
|
168
186
|
sig { returns(Grape::Request) }
|
|
169
187
|
def request; end
|
|
170
188
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grape_sorbet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thatch Health, Inc.
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '3.
|
|
32
|
+
version: '3.3'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '3.
|
|
39
|
+
version: '3.3'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: sorbet-runtime
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|