Skip to content

Commit 6090bd9

Browse files
authored
feat!: rename OpenFeature class to API and ns to OpenFeature (#82)
To make it easier to reuse the OpenFeature namespace, we need to ensure no classes/structs are named OpenFeature.
1 parent 8b738da commit 6090bd9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+174
-178
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434
- name: Pack
3535
if: ${{ steps.release.outputs.releases_created }}
3636
run: |
37-
dotnet pack OpenFeatureSDK.proj --configuration Release --no-build -p:PackageID=OpenFeature
37+
dotnet pack OpenFeature.proj --configuration Release --no-build -p:PackageID=OpenFeature
3838
3939
- name: Publish to Nuget
4040
if: ${{ steps.release.outputs.releases_created }}
4141
run: |
42-
dotnet nuget push src/OpenFeatureSDK/bin/Release/OpenFeature.${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}.nupkg `
42+
dotnet nuget push src/OpenFeature/bin/Release/OpenFeature.${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}.nupkg `
4343
--api-key ${{secrets.NUGET_TOKEN}} `
4444
--source https://api.nuget.org/v3/index.json
File renamed without changes.

OpenFeatureSDK.sln renamed to OpenFeature.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeatureSDK", "src\OpenFeatureSDK\OpenFeatureSDK.csproj", "{07A6E6BD-FB7E-4B3B-9CBE-65AE9D0EB223}"
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature", "src\OpenFeature\OpenFeature.csproj", "{07A6E6BD-FB7E-4B3B-9CBE-65AE9D0EB223}"
44
EndProject
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{72005F60-C2E8-40BF-AE95-893635134D7D}"
66
ProjectSection(SolutionItems) = preProject
@@ -29,7 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{65FBA159-2
2929
test\Directory.Build.props = test\Directory.Build.props
3030
EndProjectSection
3131
EndProject
32-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeatureSDK.Tests", "test\OpenFeatureSDK.Tests\OpenFeatureSDK.Tests.csproj", "{49BB42BA-10A6-4DA3-A7D5-38C968D57837}"
32+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Tests", "test\OpenFeature.Tests\OpenFeature.Tests.csproj", "{49BB42BA-10A6-4DA3-A7D5-38C968D57837}"
3333
EndProject
3434
Global
3535
GlobalSection(SolutionConfigurationPlatforms) = preSolution

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ The packages will aim to support all current .NET versions. Refer to the current
1717
### Basic Usage
1818

1919
```csharp
20-
using OpenFeatureSDK;
20+
using OpenFeature;
2121

2222
// Sets the provider used by the client
23-
OpenFeature.Instance.SetProvider(new NoOpProvider());
23+
Api.Instance.SetProvider(new NoOpProvider());
2424
// Gets a instance of the feature flag client
2525
var client = OpenFeature.Instance.GetClient();
2626
// Evaluation the `my-feature` feature flag
@@ -42,8 +42,8 @@ To develop a provider, you need to create a new project and include the OpenFeat
4242
Example of implementing a feature flag provider
4343

4444
```csharp
45-
using OpenFeatureSDK;
46-
using OpenFeatureSDK.Model;
45+
using OpenFeature;
46+
using OpenFeature.Model;
4747

4848
public class MyFeatureProvider : FeatureProvider
4949
{
@@ -94,10 +94,10 @@ Example of adding a hook
9494

9595
```csharp
9696
// add a hook globally, to run on all evaluations
97-
openFeature.AddHooks(new ExampleGlobalHook());
97+
Api.Instance.AddHooks(new ExampleGlobalHook());
9898

9999
// add a hook on this client, to run on all evaluations made by this client
100-
var client = OpenFeature.Instance.GetClient();
100+
var client = Api.Instance.GetClient();
101101
client.AddHooks(new ExampleClientHook());
102102

103103
// add a hook for this evaluation only

build/Common.tests.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
13-
<Content Include="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenFeatureSDK.sln'))\build\xunit.runner.json">
13+
<Content Include="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenFeature.sln'))\build\xunit.runner.json">
1414
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1515
</Content>
1616
</ItemGroup>

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<Project>
2-
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenFeatureSDK.sln'))\build\Common.prod.props" />
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenFeature.sln'))\build\Common.prod.props" />
33
</Project>

src/OpenFeatureSDK/OpenFeature.cs renamed to src/OpenFeature/Api.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
using System;
21
using System.Collections.Concurrent;
32
using System.Collections.Generic;
43
using System.Linq;
54
using System.Threading;
65
using Microsoft.Extensions.Logging;
7-
using OpenFeatureSDK.Model;
6+
using OpenFeature.Model;
87

9-
namespace OpenFeatureSDK
8+
namespace OpenFeature
109
{
1110
/// <summary>
1211
/// The evaluation API allows for the evaluation of feature flag values, independent of any flag control plane or vendor.
1312
/// In the absence of a provider the evaluation API uses the "No-op provider", which simply returns the supplied default flag value.
1413
/// </summary>
1514
/// <seealso href="https://github.com/open-feature/spec/blob/main/specification/flag-evaluation.md#flag-evaluation-api"/>
16-
public sealed class OpenFeature
15+
public sealed class Api
1716
{
1817
private EvaluationContext _evaluationContext = EvaluationContext.Empty;
1918
private FeatureProvider _featureProvider = new NoOpFeatureProvider();
@@ -24,15 +23,15 @@ public sealed class OpenFeature
2423
private readonly ReaderWriterLockSlim _featureProviderLock = new ReaderWriterLockSlim();
2524

2625
/// <summary>
27-
/// Singleton instance of OpenFeature
26+
/// Singleton instance of Api
2827
/// </summary>
29-
public static OpenFeature Instance { get; } = new OpenFeature();
28+
public static Api Instance { get; } = new Api();
3029

3130
// Explicit static constructor to tell C# compiler
3231
// not to mark type as beforefieldinit
3332
// IE Lazy way of ensuring this is thread safe without using locks
34-
static OpenFeature() { }
35-
private OpenFeature() { }
33+
static Api() { }
34+
private Api() { }
3635

3736
/// <summary>
3837
/// Sets the feature provider
@@ -58,7 +57,7 @@ public void SetProvider(FeatureProvider featureProvider)
5857
/// it should be accessed once for an operation, and then that reference should be used for all dependent
5958
/// operations. For instance, during an evaluation the flag resolution method, and the provider hooks
6059
/// should be accessed from the same reference, not two independent calls to
61-
/// <see cref="OpenFeature.GetProvider"/>.
60+
/// <see cref="GetProvider"/>.
6261
/// </para>
6362
/// </summary>
6463
/// <returns><see cref="FeatureProvider"/></returns>
@@ -80,7 +79,7 @@ public FeatureProvider GetProvider()
8079
/// <para>
8180
/// This method is not guaranteed to return the same provider instance that may be used during an evaluation
8281
/// in the case where the provider may be changed from another thread.
83-
/// For multiple dependent provider operations see <see cref="OpenFeature.GetProvider"/>.
82+
/// For multiple dependent provider operations see <see cref="GetProvider"/>.
8483
/// </para>
8584
/// </summary>
8685
/// <returns><see cref="ClientMetadata"/></returns>
@@ -111,7 +110,7 @@ public FeatureClient GetClient(string name = null, string version = null, ILogge
111110
/// Adds a hook to global hooks list
112111
/// <para>
113112
/// Hooks which are dependent on each other should be provided in a collection
114-
/// using the <see cref="AddHooks(System.Collections.Generic.IEnumerable{OpenFeatureSDK.Hook})"/>.
113+
/// using the <see cref="AddHooks(IEnumerable{Hook})"/>.
115114
/// </para>
116115
/// </summary>
117116
/// <param name="hook">Hook that implements the <see cref="Hook"/> interface</param>

src/OpenFeatureSDK/Constant/ErrorType.cs renamed to src/OpenFeature/Constant/ErrorType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.ComponentModel;
22

3-
namespace OpenFeatureSDK.Constant
3+
namespace OpenFeature.Constant
44
{
55
/// <summary>
66
/// These errors are used to indicate abnormal execution when evaluation a flag

src/OpenFeatureSDK/Constant/FlagValueType.cs renamed to src/OpenFeature/Constant/FlagValueType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace OpenFeatureSDK.Constant
1+
namespace OpenFeature.Constant
22
{
33
/// <summary>
44
/// Used to identity what object type of flag being evaluated

src/OpenFeatureSDK/Constant/NoOpProvider.cs renamed to src/OpenFeature/Constant/NoOpProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace OpenFeatureSDK.Constant
1+
namespace OpenFeature.Constant
22
{
33
internal static class NoOpProvider
44
{

0 commit comments

Comments
 (0)