Skip to content
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

chore: add migration guide for v5 #257

Merged
merged 10 commits into from
Nov 6, 2024
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
[![NuGet](https://img.shields.io/nuget/v/Unleash.Client.svg)](https://www.nuget.org/packages/Unleash.Client/)


> **Migrating to v5**
>
> If you use, [bootstrapping](#bootstrapping), [custom strategies](#custom-strategies) or use a custom JSON serializer, read the complete [migration guide](./v5_MIGRATION_GUIDE.md) before upgrading to v5.
sighphyre marked this conversation as resolved.
Show resolved Hide resolved


## Introduction

Unleash Client SDK for .Net. It is compatible with the
Expand Down
42 changes: 42 additions & 0 deletions v5_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Migrating to Unleash-Client-Dotnet 5.0.0

This guide highlights the key changes you should be aware of when upgrading to v5.0.0 of the Unleash client.

## Custom strategy changes

Custom strategies no longer provide the option to access the constraints in their interface. The method `bool IsEnabled(Dictionary<string, string> parameters, UnleashContext context, IEnumerable<Constraint> constraints)` no longer exists. Other than that, custom strategies remain unchanged.

## Direct access to feature toggles
sighphyre marked this conversation as resolved.
Show resolved Hide resolved

Direct access to the feature toggle objects through `UnleashClient.FeatureToggles` has been removed. All classes related to the internal representation of feature toggles are no longer publicly accessible in the SDK.

The SDK now provides a `UnleashClient.ListKnownToggles` method, which will return a list of feature toggle names, their type and the project they're bound to.
sighphyre marked this conversation as resolved.
Show resolved Hide resolved

## Bootstrapping changes

Due to the changes in the previous section, Bootstrapping classes are now required to return a `String` instead of a `FeatureToggleCollection`. The string should be a JSON string representing the response returned from your Unleash instance's api/client/features endpoint. In practice, that means if you previously had a `Read` method in your bootstrapping class like so:
sighphyre marked this conversation as resolved.
Show resolved Hide resolved

``` dotnet

public ToggleCollection Read()
{
var json = settings.FileSystem.ReadAllText(filePath);
return settings.JsonSerializer.Deserialize<ToggleCollection>(json);
}

```

This can now be simplified to:
sighphyre marked this conversation as resolved.
Show resolved Hide resolved

``` dotnet

public string Read()
{
return settings.FileSystem.ReadAllText(filePath);
}

```

## Custom serializers

In v4.x and before, the SDK provided the option to use NewtonSoft or mount a custom JSON serializer. This option has been removed in v5.x, the SDK now relies on System.Text.Json and no option to override that is provided. If you were previously providing a custom serializer to access System.Text.Json, that's now safe to remove. Users who were previously relying on NewtonSoft shouldn't have to make any changes.
sighphyre marked this conversation as resolved.
Show resolved Hide resolved
Loading