Skip to content

Conversation

@linglingye001
Copy link
Member

Making enabled and conditions optional according to the Feature Flag schema, where only id is required.

Copilot AI review requested due to automatic review settings November 27, 2025 09:47
@github-actions github-actions bot added the App Configuration Azure.ApplicationModel.Configuration label Nov 27, 2025
Copilot finished reviewing on behalf of linglingye001 November 27, 2025 09:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the enabled and conditions properties optional for feature flags, aligning with the Feature Flag v2.0.0 schema where only id is required. This enhances flexibility by allowing minimal feature flag definitions.

Key Changes:

  • Removed enabled and conditions from the required properties validation array
  • Added comprehensive test coverage for feature flags with optional properties (only id, without conditions, without enabled)
  • Tests verify that missing optional properties default correctly (enabled defaults to false, ClientFilters is empty)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sdk/appconfiguration/Azure.Data.AppConfiguration/src/Models/FeatureFlagConfigurationSetting.cs Updated required properties array to only include "id", making "enabled" and "conditions" optional for validation
sdk/appconfiguration/Azure.Data.AppConfiguration/tests/FeatureFlagConfigurationSettingTests.cs Added 6 new tests covering parsing and modification scenarios for feature flags with optional properties

Comment on lines +404 to +414
[Test]
public void FeatureFlagWithoutConditionsIsValid()
{
var featureFlagValue = "{\"id\":\"my feature\",\"enabled\":true}";
var featureFlag = new FeatureFlagConfigurationSetting();
featureFlag.Value = featureFlagValue;

Assert.AreEqual("my feature", featureFlag.FeatureId);
Assert.AreEqual(true, featureFlag.IsEnabled);
Assert.AreEqual(0, featureFlag.ClientFilters.Count);
}
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test coverage: There should be a test verifying that a feature flag with only id can roundtrip without modification. Currently, the CanRountripValue test doesn't include test cases for minimal feature flags (e.g., {"id":"my feature"}).

Consider adding test cases to CanRountripValue or creating a new test that verifies:

var featureFlagValue = "{\"id\":\"my feature\"}";
var featureFlag = new FeatureFlagConfigurationSetting();
featureFlag.Value = featureFlagValue;

using var expected = JsonDocument.Parse(featureFlagValue);
using var actual = JsonDocument.Parse(featureFlag.Value);
Assert.IsTrue(_jsonComparer.Equals(expected.RootElement, actual.RootElement));

This would ensure that reading and serializing without modification preserves the original minimal JSON structure.

Copilot uses AI. Check for mistakes.
@linglingye001 linglingye001 changed the title Removed enabled/conditions from feature flag required properties [App Configuration] Removed enabled/conditions from feature flag required properties Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App Configuration Azure.ApplicationModel.Configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants