Skip to content

Commit

Permalink
[AppConfig] Preserve unknown setting JSON members (Azure#38450)
Browse files Browse the repository at this point in the history
* [AppConfig] Preserve unknown setting JSON members

The focus of these changes is to fix a bug where JSON members in the
value for Feature Flags and Secret References which are not defined in
the JSON schema were discarded.  The schema itself allows for arbitrary
JSON members, the Azure portal supports them in its advanced view, and
the service documentation also refers to them.

This change preserves unknown JSON attributes while allowing the well-known
properties of the setting to override their associated JSON members.

Constructor overloads that accept an ETag were also added to Feature Flags
and Secret References.  This aligns with ConfigurationSetting and allows use
of the GetConfigurationSettingsAsync overload that accepts `onlyIfUnchanged`,
which was previously not accessible for specialized settings.
  • Loading branch information
jsquire authored Sep 6, 2023
1 parent 56bb5f5 commit f41d1a0
Show file tree
Hide file tree
Showing 10 changed files with 718 additions and 202 deletions.
12 changes: 4 additions & 8 deletions sdk/appconfiguration/Azure.Data.AppConfiguration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# Release History

## 1.3.0-beta.3 (Unreleased)

### Features Added

### Breaking Changes
## 1.2.1 (2023-09-13)

### Bugs Fixed

- Added the ability to create `FeatureFlagConfigurationSetting` and `SecretReferenceConfigurationSetting` instances for testing purposes using the `ConfigurationModelFactory`. It was previously not possible to populate service-owned fields when testing.
- `FeatureFlagConfigurationSetting` and `SecretReferenceConfigurationSetting` will now retain custom attributes in the setting value. Previously, only attributes that were defined in the associated JSON schema were allowed and unknown attributes were discarded.

- Marked a constructor overload of `ConfigurationSetting` that was intended for testing purposes as non-visible, as the `ConfigurationModelFactory` should instead be used.
- Added the ability to create `FeatureFlagConfigurationSetting` and `SecretReferenceConfigurationSetting` instances with an ETag, matching `ConfigurationSetting`. This allows all setting types to use the [GetConfigurationSettingAsync](https://learn.microsoft.com/dotnet/api/azure.data.appconfiguration.configurationclient.getconfigurationsettingasync?view=azure-dotnet#azure-data-appconfiguration-configurationclient-getconfigurationsettingasync(azure-data-appconfiguration-configurationsetting-system-boolean-system-threading-cancellationtoken)) overload that accepts `onlyIfUnchanged.` Previously, this was not possible for specialized settings types.

### Other Changes
- Added the ability to create `FeatureFlagConfigurationSetting` and `SecretReferenceConfigurationSetting` instances for testing purposes using the `ConfigurationModelFactory`. It was previously not possible to populate service-owned fields when testing.

## 1.3.0-beta.2 (2023-07-11)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public static partial class ConfigurationModelFactory
public partial class ConfigurationSetting
{
public ConfigurationSetting(string key, string value, string label = null) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public ConfigurationSetting(string key, string value, string label, Azure.ETag etag) { }
public string ContentType { get { throw null; } set { } }
public Azure.ETag ETag { get { throw null; } }
Expand Down Expand Up @@ -148,6 +147,7 @@ protected CreateSnapshotOperation() { }
public partial class FeatureFlagConfigurationSetting : Azure.Data.AppConfiguration.ConfigurationSetting
{
public FeatureFlagConfigurationSetting(string featureId, bool isEnabled, string label = null) : base (default(string), default(string), default(string)) { }
public FeatureFlagConfigurationSetting(string featureId, bool isEnabled, string label, Azure.ETag etag) : base (default(string), default(string), default(string)) { }
public System.Collections.Generic.IList<Azure.Data.AppConfiguration.FeatureFlagFilter> ClientFilters { get { throw null; } }
public string Description { get { throw null; } set { } }
public string DisplayName { get { throw null; } set { } }
Expand All @@ -165,6 +165,7 @@ public FeatureFlagFilter(string name, System.Collections.Generic.IDictionary<str
public partial class SecretReferenceConfigurationSetting : Azure.Data.AppConfiguration.ConfigurationSetting
{
public SecretReferenceConfigurationSetting(string key, System.Uri secretId, string label = null) : base (default(string), default(string), default(string)) { }
public SecretReferenceConfigurationSetting(string key, System.Uri secretId, string label, Azure.ETag etag) : base (default(string), default(string), default(string)) { }
public System.Uri SecretId { get { throw null; } set { } }
}
[System.FlagsAttribute]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/appconfiguration/Azure.Data.AppConfiguration",
"Tag": "net/appconfiguration/Azure.Data.AppConfiguration_e77be86823"
"Tag": "net/appconfiguration/Azure.Data.AppConfiguration_9577bdfe93"
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>This is the Microsoft Azure Application Configuration Service client library</Description>
<AssemblyTitle>Microsoft Azure.Data.AppConfiguration client library</AssemblyTitle>
<Version>1.3.0-beta.3</Version>
<Version>1.2.1</Version>
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
<ApiCompatVersion>1.2.0</ApiCompatVersion>
<PackageTags>Microsoft Azure Application Configuration;Data;AppConfig;$(PackageCommonTags)</PackageTags>
Expand All @@ -26,5 +26,4 @@
<Compile Include="$(AzureCoreSharedSources)NoBodyResponseOfT.cs" LinkBase="Shared" />
<Compile Include="$(AzureCoreSharedSources)PageResponseEnumerator.cs" LinkBase="Shared" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public ConfigurationSetting(string key, string value, string label = null): this
/// <param name="value">The configuration setting's value.</param>
/// <param name="label">A label used to group this configuration setting with others.</param>
/// <param name="etag">The ETag value for the configuration setting.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public ConfigurationSetting(string key, string value, string label, ETag etag)
{
Key = key;
Expand Down
Loading

0 comments on commit f41d1a0

Please sign in to comment.