-
Notifications
You must be signed in to change notification settings - Fork 28
[FSSDK-11140] Ruby: Update project config to track CMAB properties #362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new test is good, but you might add further tests for the new attribute lookup methods to verify error cases and edge cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with few comments
# Returns: | ||
# Attribute corresponding to the provided attribute key. | ||
attribute = @attribute_key_map[attribute_key] | ||
return attribute if @attribute_key_map.key?(attribute_key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much ruby knowledge, but I was curious whether we can refactor like this:
attribute = @attribute_key_map[attribute_key]
return attribute if attribute
Copilot says that will work
# Returns: | ||
# Attribute key corresponding to the provided attribute ID. | ||
attribute = @attribute_id_to_key_map[attribute_id] | ||
return attribute if @attribute_id_to_key_map.key?(attribute_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar here
lib/optimizely/helpers/constants.rb
Outdated
}, | ||
'cmab' => { | ||
'type' => 'object', | ||
'items' => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as cmab field is a single object, I guess items
field is not appropriate. Also, we can probably specify the type of attributeIds.
update suggested by copilot
'cmab' => {
'type' => 'object',
'properties' => {
'attributeIds' => {
'type' => 'array',
'items' => { 'type' => 'string' }
},
'trafficAllocation' => {
'type' => 'integer'
}
}
}
Summary
Test plan
Issues