sorbet-runtime 0.5.9267 → 0.5.9271

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/types/props/decorator.rb +2 -44
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ed2af794518a54686c8a19decce01e150f1403f21cdc5e655d3bdba9508bf4b
4
- data.tar.gz: 7e119b3388be6f114273164db1b6afe0dd1c43eb31b03934cf958081fb3d8ae0
3
+ metadata.gz: 487c6488afdbca9a344fdc2caf3cd6afee92e621fca6460687a6f986c19fa7df
4
+ data.tar.gz: 7bd07b7c270d00c752e2cb317ce98ab3d9d7a2ebd7b6c7df5b6f096ad05e402c
5
5
  SHA512:
6
- metadata.gz: b9bd6299ed1aa59bc85d4ee0d5311510109e0b350a0f08329214a95128c0a716d4129873268f265c72694e6b5b31fbaa3190ec10cbf94e0124e7dacdd53203aa
7
- data.tar.gz: '0586deb12fcf163ff9d820a55b76d0e41d35d5b470eb3b85e48c09aad152fce40ade6eab3fa3ac67a6982e63adff862b65ef2dc55ee15bf202d691a8be3e965c'
6
+ metadata.gz: bb150c4504dd1f78878df81585885beea086dd349702956d1f502b8570320adca26f9ab50d4220e0f9a99875be78075449a4d341ab2669b8c7ba883ecca60270
7
+ data.tar.gz: 4e8d70a61582e81ffbd711dc8261e6ae4076622e755c8132030aff572de19bbe640a78d05fe28b1782d02d64661e757488b2c007e3a7caba76825c3c55d822d0
@@ -61,7 +61,6 @@ class T::Props::Decorator
61
61
  VALID_RULE_KEYS = T.let(%i[
62
62
  enum
63
63
  foreign
64
- foreign_hint_only
65
64
  ifunset
66
65
  immutable
67
66
  override
@@ -359,12 +358,7 @@ class T::Props::Decorator
359
358
  # get at the property (e.g., Chalk::ODM::Document exposes `get` and `set`).
360
359
  define_getter_and_setter(name, rules) unless rules[:without_accessors]
361
360
 
362
- if rules[:foreign] && rules[:foreign_hint_only]
363
- raise ArgumentError.new(":foreign and :foreign_hint_only are mutually exclusive.")
364
- end
365
-
366
361
  handle_foreign_option(name, cls, rules, rules[:foreign]) if rules[:foreign]
367
- handle_foreign_hint_only_option(name, cls, rules[:foreign_hint_only]) if rules[:foreign_hint_only]
368
362
  handle_redaction_option(name, rules[:redaction]) if rules[:redaction]
369
363
  end
370
364
 
@@ -484,42 +478,6 @@ class T::Props::Decorator
484
478
  end
485
479
  end
486
480
 
487
- sig do
488
- params(
489
- prop_name: Symbol,
490
- prop_cls: Module,
491
- foreign_hint_only: T.untyped,
492
- )
493
- .void
494
- end
495
- private def handle_foreign_hint_only_option(prop_name, prop_cls, foreign_hint_only)
496
- if ![String, Array].include?(prop_cls) && !prop_cls.is_a?(T::Props::CustomType)
497
- raise ArgumentError.new(
498
- "`foreign_hint_only` can only be used with String or Array prop types"
499
- )
500
- end
501
-
502
- validate_foreign_option(
503
- :foreign_hint_only, foreign_hint_only,
504
- valid_type_msg: "an individual or array of a model class, or a Proc returning such."
505
- )
506
-
507
- unless foreign_hint_only.is_a?(Proc)
508
- T::Configuration.soft_assert_handler(<<~MESSAGE, storytime: {prop: prop_name, value: foreign_hint_only}, notify: 'jerry')
509
- Please use a Proc that returns a model class instead of the model class itself as the argument to `foreign_hint_only`. In other words:
510
-
511
- instead of `prop :foo, String, foreign_hint_only: FooModel`
512
- use `prop :foo, String, foreign_hint_only: -> {FooModel}`
513
-
514
- OR
515
-
516
- instead of `prop :foo, String, foreign_hint_only: [FooModel, BarModel]`
517
- use `prop :foo, String, foreign_hint_only: -> {[FooModel, BarModel]}`
518
-
519
- MESSAGE
520
- end
521
- end
522
-
523
481
  # checked(:never) - Rules hash is expensive to check
524
482
  sig do
525
483
  params(
@@ -598,8 +556,8 @@ class T::Props::Decorator
598
556
  # keep them from being lurky performance hits by issuing a bunch of un-batched DB queries.
599
557
  # We could potentially address that by porting over something like AmbiguousIDLoader.
600
558
  raise ArgumentError.new(
601
- "Using an array for `foreign` is no longer supported. Instead, use `foreign_hint_only` " \
602
- "with an array or a Proc that returns an array, e.g., foreign_hint_only: -> {[Foo, Bar]}"
559
+ "Using an array for `foreign` is no longer supported. Instead, please use a union type of " \
560
+ "token types for the prop type, e.g., T.any(Opus::Autogen::Tokens::FooModelToken, Opus::Autogen::Tokens::BarModelToken)"
603
561
  )
604
562
  end
605
563
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet-runtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9267
4
+ version: 0.5.9271
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest