Skip to content

Commit 3b2b409

Browse files
Merge pull request #579 from OneBusAway/release-please--branches--main--changes--next
release: 1.0.24
2 parents c92f362 + fe2333d commit 3b2b409

File tree

16 files changed

+175
-18
lines changed

16 files changed

+175
-18
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.0.23"
2+
".": "1.0.24"
33
}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 1.0.24 (2025-08-10)
4+
5+
Full Changelog: [v1.0.23...v1.0.24](https://github.com/OneBusAway/ruby-sdk/compare/v1.0.23...v1.0.24)
6+
7+
### Chores
8+
9+
* collect metadata from type DSL ([8c6ebea](https://github.com/OneBusAway/ruby-sdk/commit/8c6ebea6b7370965b7809e6747599dda37628a93))
10+
* **internal:** update comment in script ([008e80f](https://github.com/OneBusAway/ruby-sdk/commit/008e80fd1d7f13cfe7c09f8cca1da9b11072388d))
11+
* update @stainless-api/prism-cli to v5.15.0 ([2849a58](https://github.com/OneBusAway/ruby-sdk/commit/2849a582e1b7446b830f9e882575b9d5ba9e629c))
12+
313
## 1.0.23 (2025-08-01)
414

515
Full Changelog: [v1.0.22...v1.0.23](https://github.com/OneBusAway/ruby-sdk/compare/v1.0.22...v1.0.23)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
1717
<!-- x-release-please-start-version -->
1818

1919
```ruby
20-
gem "onebusaway-sdk", "~> 1.0.23"
20+
gem "onebusaway-sdk", "~> 1.0.24"
2121
```
2222

2323
<!-- x-release-please-end -->

lib/onebusaway_sdk/internal/type/array_of.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def to_sorbet_type
148148
# @option spec [Boolean] :"nil?"
149149
def initialize(type_info, spec = {})
150150
@item_type_fn = OnebusawaySDK::Internal::Type::Converter.type_info(type_info || spec)
151+
@meta = OnebusawaySDK::Internal::Type::Converter.meta_info(type_info, spec)
151152
@nilable = spec.fetch(:nil?, false)
152153
end
153154

lib/onebusaway_sdk/internal/type/base_model.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def fields
5252
#
5353
# @option spec [Boolean] :"nil?"
5454
private def add_field(name_sym, required:, type_info:, spec:)
55+
meta = OnebusawaySDK::Internal::Type::Converter.meta_info(type_info, spec)
5556
type_fn, info =
5657
case type_info
5758
in Proc | OnebusawaySDK::Internal::Type::Converter | Class
@@ -81,7 +82,8 @@ def fields
8182
required: required,
8283
nilable: nilable,
8384
const: const,
84-
type_fn: type_fn
85+
type_fn: type_fn,
86+
meta: meta
8587
}
8688

8789
define_method(setter) do |value|

lib/onebusaway_sdk/internal/type/converter.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,33 @@ def type_info(spec)
9898
end
9999
end
100100

101+
# @api private
102+
#
103+
# @param type_info [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Internal::Type::Converter, Class] .
104+
#
105+
# @option type_info [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
106+
#
107+
# @option type_info [Proc] :enum
108+
#
109+
# @option type_info [Proc] :union
110+
#
111+
# @option type_info [Boolean] :"nil?"
112+
#
113+
# @param spec [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Internal::Type::Converter, Class] .
114+
#
115+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
116+
#
117+
# @option spec [Proc] :enum
118+
#
119+
# @option spec [Proc] :union
120+
#
121+
# @option spec [Boolean] :"nil?"
122+
#
123+
# @return [Hash{Symbol=>Object}]
124+
def meta_info(type_info, spec)
125+
[spec, type_info].grep(Hash).first.to_h.except(:const, :enum, :union, :nil?)
126+
end
127+
101128
# @api private
102129
#
103130
# @param translate_names [Boolean]

lib/onebusaway_sdk/internal/type/hash_of.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def to_sorbet_type
168168
# @option spec [Boolean] :"nil?"
169169
def initialize(type_info, spec = {})
170170
@item_type_fn = OnebusawaySDK::Internal::Type::Converter.type_info(type_info || spec)
171+
@meta = OnebusawaySDK::Internal::Type::Converter.meta_info(type_info, spec)
171172
@nilable = spec.fetch(:nil?, false)
172173
end
173174

lib/onebusaway_sdk/internal/type/union.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ module Union
1212
#
1313
# All of the specified variant info for this union.
1414
#
15-
# @return [Array<Array(Symbol, Proc)>]
15+
# @return [Array<Array(Symbol, Proc, Hash{Symbol=>Object})>]
1616
private def known_variants = (@known_variants ||= [])
1717

1818
# @api private
1919
#
20-
# @return [Array<Array(Symbol, Object)>]
20+
# @return [Array<Array(Symbol, Object, Hash{Symbol=>Object})>]
2121
protected def derefed_variants
22-
known_variants.map { |key, variant_fn| [key, variant_fn.call] }
22+
known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] }
2323
end
2424

2525
# All of the specified variants for this union.
2626
#
2727
# @return [Array<Object>]
28-
def variants = derefed_variants.map(&:last)
28+
def variants = derefed_variants.map { _2 }
2929

3030
# @api private
3131
#
@@ -51,12 +51,13 @@ def variants = derefed_variants.map(&:last)
5151
#
5252
# @option spec [Boolean] :"nil?"
5353
private def variant(key, spec = nil)
54+
meta = OnebusawaySDK::Internal::Type::Converter.meta_info(nil, spec)
5455
variant_info =
5556
case key
5657
in Symbol
57-
[key, OnebusawaySDK::Internal::Type::Converter.type_info(spec)]
58+
[key, OnebusawaySDK::Internal::Type::Converter.type_info(spec), meta]
5859
in Proc | OnebusawaySDK::Internal::Type::Converter | Class | Hash
59-
[nil, OnebusawaySDK::Internal::Type::Converter.type_info(key)]
60+
[nil, OnebusawaySDK::Internal::Type::Converter.type_info(key), meta]
6061
end
6162

6263
known_variants << variant_info
@@ -79,7 +80,8 @@ def variants = derefed_variants.map(&:last)
7980
return nil if key == OnebusawaySDK::Internal::OMIT
8081

8182
key = key.to_sym if key.is_a?(String)
82-
known_variants.find { |k,| k == key }&.last&.call
83+
_, found = known_variants.find { |k,| k == key }
84+
found&.call
8385
else
8486
nil
8587
end

lib/onebusaway_sdk/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module OnebusawaySDK
4-
VERSION = "1.0.23"
4+
VERSION = "1.0.24"
55
end

rbi/onebusaway_sdk/internal/type/converter.rbi

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,64 @@ module OnebusawaySDK
9595
def self.type_info(spec)
9696
end
9797

98+
# @api private
99+
sig do
100+
params(
101+
type_info:
102+
T.any(
103+
{
104+
const:
105+
T.nilable(
106+
T.any(NilClass, T::Boolean, Integer, Float, Symbol)
107+
),
108+
enum:
109+
T.nilable(
110+
T.proc.returns(
111+
OnebusawaySDK::Internal::Type::Converter::Input
112+
)
113+
),
114+
union:
115+
T.nilable(
116+
T.proc.returns(
117+
OnebusawaySDK::Internal::Type::Converter::Input
118+
)
119+
)
120+
},
121+
T.proc.returns(
122+
OnebusawaySDK::Internal::Type::Converter::Input
123+
),
124+
OnebusawaySDK::Internal::Type::Converter::Input
125+
),
126+
spec:
127+
T.any(
128+
{
129+
const:
130+
T.nilable(
131+
T.any(NilClass, T::Boolean, Integer, Float, Symbol)
132+
),
133+
enum:
134+
T.nilable(
135+
T.proc.returns(
136+
OnebusawaySDK::Internal::Type::Converter::Input
137+
)
138+
),
139+
union:
140+
T.nilable(
141+
T.proc.returns(
142+
OnebusawaySDK::Internal::Type::Converter::Input
143+
)
144+
)
145+
},
146+
T.proc.returns(
147+
OnebusawaySDK::Internal::Type::Converter::Input
148+
),
149+
OnebusawaySDK::Internal::Type::Converter::Input
150+
)
151+
).returns(OnebusawaySDK::Internal::AnyHash)
152+
end
153+
def self.meta_info(type_info, spec)
154+
end
155+
98156
# @api private
99157
sig do
100158
params(translate_names: T::Boolean).returns(

0 commit comments

Comments
 (0)