openfeature-sdk-sorbet 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/open_feature/client.rb +4 -4
- data/lib/open_feature/no_op_provider.rb +2 -2
- data/lib/open_feature/provider.rb +2 -2
- data/lib/open_feature/structure.rb +6 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75df060a41ea89c620620e99d361a57dacbc4ca4df2c28112100ba4020da22e6
|
4
|
+
data.tar.gz: e0aa5083da80f8f6dc3b47edf67baf6e02a310381743b72ecf86a51005317a82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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
|
|
data/lib/open_feature/client.rb
CHANGED
@@ -145,10 +145,10 @@ module OpenFeature
|
|
145
145
|
sig do
|
146
146
|
params(
|
147
147
|
flag_key: String,
|
148
|
-
default_value:
|
148
|
+
default_value: Structure,
|
149
149
|
context: T.nilable(EvaluationContext),
|
150
150
|
options: T.nilable(EvaluationOptions)
|
151
|
-
).returns(
|
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:
|
162
|
+
default_value: Structure,
|
163
163
|
context: T.nilable(EvaluationContext),
|
164
164
|
options: T.nilable(EvaluationOptions)
|
165
|
-
).returns(EvaluationDetails[
|
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:
|
68
|
+
default_value: Structure,
|
69
69
|
context: T.nilable(EvaluationContext)
|
70
70
|
)
|
71
|
-
.returns(ResolutionDetails[
|
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:
|
54
|
+
default_value: Structure,
|
55
55
|
context: T.nilable(EvaluationContext)
|
56
56
|
)
|
57
|
-
.returns(ResolutionDetails[
|
57
|
+
.returns(ResolutionDetails[Structure])
|
58
58
|
end
|
59
59
|
def resolve_structure_value(flag_key:, default_value:, context: nil); end
|
60
60
|
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.
|
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
|