-
Notifications
You must be signed in to change notification settings - Fork 3
Minimize exposed API #29
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
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
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
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
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
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 |
---|---|---|
|
@@ -66,7 +66,7 @@ pub(crate) struct Property { | |
} | ||
|
||
#[derive(Copy, Clone, Debug, Deserialize, PartialEq)] | ||
pub enum ValueKind { | ||
pub(crate) enum ValueKind { | ||
#[serde(rename(deserialize = "NUMERIC"))] | ||
Numeric, | ||
#[serde(rename(deserialize = "BOOLEAN"))] | ||
|
@@ -87,7 +87,7 @@ impl Display for ValueKind { | |
} | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
pub struct ConfigValue(pub(crate) serde_json::Value); | ||
pub(crate) struct ConfigValue(pub(crate) serde_json::Value); | ||
|
||
impl ConfigValue { | ||
pub fn as_i64(&self) -> Option<i64> { | ||
|
@@ -133,27 +133,27 @@ pub(crate) struct SegmentRule { | |
} | ||
|
||
#[derive(Debug, Deserialize, Clone)] | ||
pub struct TargetingRule { | ||
pub(crate) struct TargetingRule { | ||
pub rules: Vec<Segments>, | ||
pub value: ConfigValue, | ||
pub order: u32, | ||
pub rollout_percentage: Option<ConfigValue>, | ||
} | ||
|
||
#[derive(Debug, Deserialize, Clone)] | ||
pub struct Segments { | ||
pub(crate) struct Segments { | ||
pub segments: Vec<String>, | ||
} | ||
|
||
#[cfg(test)] | ||
pub mod tests { | ||
pub(crate) mod tests { | ||
|
||
use super::*; | ||
use rstest::*; | ||
use std::{fs, path::PathBuf}; | ||
|
||
#[fixture] | ||
pub fn example_configuration_enterprise() -> Configuration { | ||
pub(crate) fn example_configuration_enterprise() -> Configuration { | ||
Comment on lines
+144
to
+156
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. Just for my understanding:
and sometimes
? |
||
// Create a configuration object from the data files | ||
|
||
let mut mocked_data = PathBuf::from(env!("CARGO_MANIFEST_DIR")); | ||
|
@@ -166,7 +166,7 @@ pub mod tests { | |
} | ||
|
||
#[fixture] | ||
pub fn configuration_feature1_enabled() -> Configuration { | ||
pub(crate) fn configuration_feature1_enabled() -> Configuration { | ||
Configuration { | ||
environments: vec![Environment { | ||
name: "name".to_string(), | ||
|
@@ -189,7 +189,7 @@ pub mod tests { | |
} | ||
|
||
#[fixture] | ||
pub fn configuration_property1_enabled() -> Configuration { | ||
pub(crate) fn configuration_property1_enabled() -> Configuration { | ||
Configuration { | ||
environments: vec![Environment { | ||
name: "name".to_string(), | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
for the future:
Not sure if
is_enabled
this is something we want to expose to the user. The concept of "enabled" is hard to understand and does not consider entity evaluation.It might be confusing to see the feature as
enabled
but when getting the value (using entity) a user will see thedisabled
value, as then rollout percentage and segment evaluation is considered.It might tempt users to use the
is_enabled()
function to evaluate the feature (assuming most features are boolean) which would give wrong results.IMHO, the client should not provide this function, only admin interface server config should give control over this.
maybe @saikumar1607 can help to clarify?
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.
If a feature is disabled, the user can choose not to evaluate it for the entities, but it doesn't mean that the user knows the enabled and disabled values.
Only using our
get_value
, the user can retrieve the values.... and it requires theEntity
:And of course, even if the features are boolean and "disabled" means "false", the user won't benefit of the rollout related capabilities provided by IBM AppConfiguration.
In my mind, knowing if a feature is enabled or not, could be needed for applications that might choose whether to load a module or not. For example, given an e-commerce, if the "groceries feature" is not enabled, I won't load that module (maybe at startup time). Or, for example, if the "advanced-pricing" is disabled, I will just use default pricing for all the users instead of running some evaluation for each product for each user.