Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/open_feature/sdk/client_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ module OpenFeature
module SDK
ClientMetadata = Struct.new(:domain, keyword_init: true) do
alias_method :name, :domain

def initialize(domain: nil)
super(domain: domain&.dup&.freeze)
freeze
end
end
end
end
5 changes: 5 additions & 0 deletions spec/open_feature/sdk/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
expect(client).to respond_to(:metadata)
expect(client.metadata.domain).to eq(domain)
end

it "client metadata is frozen (req 4.2.2.1 — hook context client_metadata must be immutable)" do
expect(client.metadata).to be_frozen
Comment thread
cristiangmarta marked this conversation as resolved.
expect(client.metadata.domain).to be_frozen
end
Comment thread
cristiangmarta marked this conversation as resolved.
end

context "Flag evaluation" do
Expand Down