openfeature-sdk-sorbet 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5bada3dd0c6a4687fb9c7f44768f668d809a4d12fdd11439d000ed77e10340e
4
- data.tar.gz: 952ebbe9649d88fd4a76cbb29af2709514d863c1be6106e73f132092a2d9d9c7
3
+ metadata.gz: 75df060a41ea89c620620e99d361a57dacbc4ca4df2c28112100ba4020da22e6
4
+ data.tar.gz: e0aa5083da80f8f6dc3b47edf67baf6e02a310381743b72ecf86a51005317a82
5
5
  SHA512:
6
- metadata.gz: 26655c2337a276815db33affb69d3c53c2b48dd7176c6acf6e365caa0e7b84f8899a96a786376f1a316f5aa1618cc540f8e4ac8bb6d05c38dd1011f6e94641fb
7
- data.tar.gz: b0e88fc7f6f91e85294126fc23c9a58a45165bc4b7f3394c158413955fdd428c250edb82a915d2a78491e7a2c2141b86fda0ef5b1ba96552166c22fd17ba2c51
6
+ metadata.gz: 52b1805c282d14bdfbb1e79169cce49f4296c8c82b93f0a78288db8d41d5ebd542061c3e66834ea617a14a6555f7247ca7461ee0f70c2560fc173da51ee8922f
7
+ data.tar.gz: 2e8c810a78304daf139be9d4b0bebae008a12aeda77ba6d6cb46e646efbb71f543743b93ba40afd675e90058c225c926c91e8a3152b743b9b0860c0b8b96e9fc
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.1.1] - 2023-05-15
10
+
11
+ ### Changed
12
+
13
+ - Expanded type of structure resolver to `T.any(T::Array[T.untyped], T::Hash[T.untyped, T.untyped])`
14
+
9
15
  ## [0.1.0] - 2023-05-15
10
16
 
11
17
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openfeature-sdk-sorbet (0.1.0)
4
+ openfeature-sdk-sorbet (0.1.1)
5
5
  sorbet-runtime (~> 0.5)
6
6
  sorbet-struct-comparable (~> 1.3)
7
7
  zeitwerk (~> 2.6)
data/README.md CHANGED
@@ -43,7 +43,7 @@ structure_evaluation_details = client.fetch_structure_details(flag_key: "my_stru
43
43
 
44
44
  ### Note on `Structure`
45
45
 
46
- The OpenFeature specification defines [Structure as a potential return type](https://openfeature.dev/specification/types#structure). This is somewhat ambiguous in Ruby, further complicated by `T::Struct` that we get from Sorbet. For now, the type I've elected here is `T::Hash[T.untyped, T.untyped]` for flexibility but with a little more structure than a YML or JSON parsable string. This decision might change in the future upon further interpretation or new versions of the specification.
46
+ The OpenFeature specification defines [Structure as a potential return type](https://openfeature.dev/specification/types#structure). This is somewhat ambiguous in Ruby, further complicated by `T::Struct` that we get from Sorbet. For now, the type I've elected here is `T.any(T::Array[T.untyped], T::Hash[T.untyped, T.untyped]` (loosely, either an Array of untyped members or a Hash with untyped keys and untyped values) for flexibility but with a little more structure than a YML or JSON parsable string. This decision might change in the future upon further interpretation or new versions of the specification.
47
47
 
48
48
  ### Provider Interface
49
49
 
@@ -145,10 +145,10 @@ module OpenFeature
145
145
  sig do
146
146
  params(
147
147
  flag_key: String,
148
- default_value: T::Hash[T.untyped, T.untyped],
148
+ default_value: Structure,
149
149
  context: T.nilable(EvaluationContext),
150
150
  options: T.nilable(EvaluationOptions)
151
- ).returns(T::Hash[T.untyped, T.untyped])
151
+ ).returns(Structure)
152
152
  end
153
153
  def fetch_structure_value(flag_key:, default_value:, context: nil, options: nil) # rubocop:disable Lint/UnusedMethodArgument
154
154
  provider.resolve_structure_value(flag_key: flag_key, default_value: default_value, context: context).value
@@ -159,10 +159,10 @@ module OpenFeature
159
159
  sig do
160
160
  params(
161
161
  flag_key: String,
162
- default_value: T::Hash[T.untyped, T.untyped],
162
+ default_value: Structure,
163
163
  context: T.nilable(EvaluationContext),
164
164
  options: T.nilable(EvaluationOptions)
165
- ).returns(EvaluationDetails[T::Hash[T.untyped, T.untyped]])
165
+ ).returns(EvaluationDetails[Structure])
166
166
  end
167
167
  def fetch_structure_details(flag_key:, default_value:, context: nil, options: nil) # rubocop:disable Lint/UnusedMethodArgument
168
168
  details = provider.resolve_structure_value(flag_key: flag_key, default_value: default_value, context: context)
@@ -65,10 +65,10 @@ module OpenFeature
65
65
  override
66
66
  .params(
67
67
  flag_key: String,
68
- default_value: T::Hash[T.untyped, T.untyped],
68
+ default_value: Structure,
69
69
  context: T.nilable(EvaluationContext)
70
70
  )
71
- .returns(ResolutionDetails[T::Hash[T.untyped, T.untyped]])
71
+ .returns(ResolutionDetails[Structure])
72
72
  end
73
73
  def resolve_structure_value(flag_key:, default_value:, context: nil)
74
74
  ResolutionDetails.new(value: default_value, reason: "DEFAULT")
@@ -51,10 +51,10 @@ module OpenFeature
51
51
  abstract
52
52
  .params(
53
53
  flag_key: String,
54
- default_value: T::Hash[T.untyped, T.untyped],
54
+ default_value: Structure,
55
55
  context: T.nilable(EvaluationContext)
56
56
  )
57
- .returns(ResolutionDetails[T::Hash[T.untyped, T.untyped]])
57
+ .returns(ResolutionDetails[Structure])
58
58
  end
59
59
  def resolve_structure_value(flag_key:, default_value:, context: nil); end
60
60
  end
@@ -0,0 +1,6 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module OpenFeature
5
+ Structure = T.type_alias { T.any(T::Array[T.untyped], T::Hash[T.untyped, T.untyped]) }
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openfeature-sdk-sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max VelDink
@@ -84,6 +84,7 @@ files:
84
84
  - lib/open_feature/provider.rb
85
85
  - lib/open_feature/provider_metadata.rb
86
86
  - lib/open_feature/resolution_details.rb
87
+ - lib/open_feature/structure.rb
87
88
  - sorbet/config
88
89
  - sorbet/rbi/annotations/rainbow.rbi
89
90
  - sorbet/rbi/gems/ast@2.4.2.rbi