microsoft / FeatureManagement-Dotnet

Microsoft.FeatureManagement provides standardized APIs for enabling feature flags within applications. Utilize this library to secure a consistent experience when developing applications that use patterns such as beta access, rollout, dark deployments, and more.
MIT License
1.02k stars 111 forks source link

Respect .NET and Microsoft feature management schemas in configuration #470

Closed zhiyuanliang-ms closed 1 month ago

zhiyuanliang-ms commented 1 month ago

Why this PR?

This PR is created to work in conjunction with Support both .NET and microsoft schema for feature flags for .NET provider.

Our .NET provider starts to embrace the Microsoft feature management schema. To avoid the breaking change that old versions of feature management library (ealier than 3.2.0) cannot work with v8 .NET provider. The .NET provider will put feature flags into configuration in both .NET feature management schema and Microsoft schema. More specifically, all variant feature flags will be converted to the Microsoft schema, while regular feature flags will be converted to the .NET schema. This results in both schemas being present in the configuration simultaneously.

Feature management library needs to recognize and respect both of them.

Visible changes

Previously, our ConfigurationFeatureDefinitionProvider will only respect one of Microsoft schema or .NET schema. If Microsoft schema can be found, any feature flag written in .NET schema will be ignored. This PR changes this behavior. All feature flags written in Microsoft schema and .NET schema will be recognized and used.

Now, when RootConfigurationFallbackEnabled, it will only look for feature flags written in .NET schema. We don't want to break people who is using this function #308. But we also don't want to keep it for our new Microsoft schema because there will be a lot of corner cases when we support both .NET and Microsoft schema.