-
Notifications
You must be signed in to change notification settings - Fork 28
feat: Added new getFeatureVariableJson and getAllFeatureVariables Apis #251
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
11e7feb
Implemented getFeatureVariableJson
zashraf1985 894aa77
moved common logic to a separate function to support get_all_feature_…
zashraf1985 430f221
added get_all_feature_variables and its tests
zashraf1985 222c4ad
added notifications for get_all_feature_variables and added unit tests
zashraf1985 03732b8
Merge branch 'master' into zeeshan/feature-json
zashraf1985 41f5eac
added doc comments and updated copyright information
zashraf1985 22e4b6d
removed whitespaces
zashraf1985 1b1ed67
fixed a minor nit
zashraf1985 5e26a71
removed unnecessary order
zashraf1985 c04f94d
Merge branch 'master' into zeeshan/feature-json
zashraf1985 cd2ee7d
refactored a test
zashraf1985 4ccea78
added notification listener tests for get_feature_variable_json
zashraf1985 95b0de1
added source info verification to the tests for feature tests
zashraf1985 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright 2019, Optimizely and contributors | ||
# Copyright 2019-2020, Optimizely and contributors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
|
@@ -82,6 +82,17 @@ def initialize(datafile, logger, error_handler) | |
@revision = config['revision'] | ||
@rollouts = config.fetch('rollouts', []) | ||
|
||
# Json type is represented in datafile as a subtype of string for the sake of backwards compatibility. | ||
# Converting it to a first-class json type while creating Project Config | ||
@feature_flags.each do |feature_flag| | ||
feature_flag['variables'].each do |variable| | ||
if variable['type'] == 'string' && variable['subType'] == 'json' | ||
variable['type'] = 'json' | ||
variable.delete('subType') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize why. I just :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah i agree. it looks ugly. |
||
end | ||
end | ||
end | ||
|
||
# Utility maps for quick lookup | ||
@attribute_key_map = generate_key_map(@attributes, 'key') | ||
@event_key_map = generate_key_map(@events, 'key') | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
isn't this out of scope?
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.
No. It was decided to add a notification for all-feature-variables later. This is bein added in all the sdks now