Skip to content

Commit 35f1128

Browse files
committed
Fix tapioca compiler behaviour for custom return types
1 parent e742eac commit 35f1128

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
shale-builder (0.5.1)
4+
shale-builder (0.5.2)
55
booleans (>= 0.1)
66
shale (< 2.0)
77
sorbet-runtime (> 0.5)

lib/shale/builder/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Shale
44
module Builder
5-
VERSION = '0.5.1'
5+
VERSION = '0.5.2'
66
end
77
end

lib/tapioca/dsl/compilers/shale.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def decorate
4040
attribute = constant.attributes[attribute_name] #: ::Shale::Attribute
4141
if (type = attribute.return_type)
4242
return_type = type
43+
nilable = true
4344
else
4445
return_type, nilable = shale_type_to_sorbet_return_type(attribute)
4546
end
@@ -58,6 +59,7 @@ def decorate
5859

5960
if (type = attribute.return_type || attribute.setter_type)
6061
setter_type = type
62+
nilable = true
6163
else
6264
setter_type, nilable = shale_type_to_sorbet_setter_type(attribute)
6365
end

test/shale/builder_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class TestTransactionResponseType < ::Shale::Mapper
2626
attribute :cvv_code, ::Shale::Type::String
2727
attribute :amount, TestAmountType
2828
attribute :success, ::Shale::Type::Boolean
29+
attribute :aux, ::Shale::Type::Value, return_type: Integer
2930
end
3031

3132
class TestTransactionType < ::Shale::Mapper

0 commit comments

Comments
 (0)