Skip to content

Commit 0238e63

Browse files
committed
feat! rename OpenFeature class to API and ns to OpenFeature
To make it easier to reuse the OpenFeature namespace we need to make sure no classes/structs are named OpenFeature Signed-off-by: Benjamin Evenson <[email protected]>
1 parent 8b738da commit 0238e63

Some content is hidden

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

44 files changed

+174
-175
lines changed

.github/workflows/release.yml

+2-2
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

OpenFeatureSDK.sln OpenFeature.sln

+2-2
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

+6-6
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

+1-1
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

+1-1
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 src/OpenFeature/Api.cs

+10-11
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="Api.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="Api.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(System.Collections.Generic.IEnumerable{Hook})"/>.
115114
/// </para>
116115
/// </summary>
117116
/// <param name="hook">Hook that implements the <see cref="Hook"/> interface</param>

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

+1-1
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 src/OpenFeature/Constant/FlagValueType.cs

+1-1
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 src/OpenFeature/Constant/NoOpProvider.cs

+1-1
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
{

src/OpenFeatureSDK/Constant/Reason.cs src/OpenFeature/Constant/Reason.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace OpenFeatureSDK.Constant
1+
namespace OpenFeature.Constant
22
{
33
/// <summary>
44
/// Common reasons used during flag resolution

src/OpenFeatureSDK/Error/FeatureProviderException.cs src/OpenFeature/Error/FeatureProviderException.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
2-
using OpenFeatureSDK.Constant;
2+
using OpenFeature.Constant;
33

4-
namespace OpenFeatureSDK.Error
4+
namespace OpenFeature.Error
55
{
66
/// <summary>
77
/// Used to represent an abnormal error when evaluating a flag. This exception should be thrown

src/OpenFeatureSDK/Extension/EnumExtensions.cs src/OpenFeature/Extension/EnumExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.ComponentModel;
33
using System.Linq;
44

5-
namespace OpenFeatureSDK.Extension
5+
namespace OpenFeature.Extension
66
{
77
internal static class EnumExtensions
88
{

src/OpenFeatureSDK/Extension/ResolutionDetailsExtensions.cs src/OpenFeature/Extension/ResolutionDetailsExtensions.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using OpenFeatureSDK.Model;
1+
using OpenFeature.Model;
22

3-
namespace OpenFeatureSDK.Extension
3+
namespace OpenFeature.Extension
44
{
55
internal static class ResolutionDetailsExtensions
66
{

src/OpenFeatureSDK/FeatureProvider.cs src/OpenFeature/FeatureProvider.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Collections.Immutable;
22
using System.Threading.Tasks;
3-
using OpenFeatureSDK.Model;
3+
using OpenFeature.Model;
44

5-
namespace OpenFeatureSDK
5+
namespace OpenFeature
66
{
77
/// <summary>
88
/// The provider interface describes the abstraction layer for a feature flag provider.

src/OpenFeatureSDK/Hook.cs src/OpenFeature/Hook.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Threading.Tasks;
4-
using OpenFeatureSDK.Model;
4+
using OpenFeature.Model;
55

6-
namespace OpenFeatureSDK
6+
namespace OpenFeature
77
{
88
/// <summary>
99
/// The Hook abstract class describes the default implementation for a hook.

src/OpenFeatureSDK/IFeatureClient.cs src/OpenFeature/IFeatureClient.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Collections.Generic;
22
using System.Threading.Tasks;
3-
using OpenFeatureSDK.Model;
3+
using OpenFeature.Model;
44

5-
namespace OpenFeatureSDK
5+
namespace OpenFeature
66
{
77
internal interface IFeatureClient
88
{

src/OpenFeatureSDK/Model/ClientMetadata.cs src/OpenFeature/Model/ClientMetadata.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace OpenFeatureSDK.Model
1+
namespace OpenFeature.Model
22
{
33
/// <summary>
44
/// Represents the client metadata

src/OpenFeatureSDK/Model/EvaluationContext.cs src/OpenFeature/Model/EvaluationContext.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
using System.Collections.Immutable;
44

5-
namespace OpenFeatureSDK.Model
5+
namespace OpenFeature.Model
66
{
77
/// <summary>
88
/// A KeyValuePair with a string key and object value that is used to apply user defined properties

src/OpenFeatureSDK/Model/EvaluationContextBuilder.cs src/OpenFeature/Model/EvaluationContextBuilder.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace OpenFeatureSDK.Model
3+
namespace OpenFeature.Model
44
{
55
/// <summary>
66
/// A builder which allows the specification of attributes for an <see cref="EvaluationContext"/>.

src/OpenFeatureSDK/Model/FlagEvaluationDetails.cs src/OpenFeature/Model/FlagEvaluationDetails.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using OpenFeatureSDK.Constant;
1+
using OpenFeature.Constant;
22

3-
namespace OpenFeatureSDK.Model
3+
namespace OpenFeature.Model
44
{
55
/// <summary>
66
/// The contract returned to the caller that describes the result of the flag evaluation process.

src/OpenFeatureSDK/Model/FlagEvaluationOptions.cs src/OpenFeature/Model/FlagEvaluationOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Immutable;
22

3-
namespace OpenFeatureSDK.Model
3+
namespace OpenFeature.Model
44
{
55
/// <summary>
66
/// A structure containing the one or more hooks and hook hints

src/OpenFeatureSDK/Model/HookContext.cs src/OpenFeature/Model/HookContext.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
2-
using OpenFeatureSDK.Constant;
2+
using OpenFeature.Constant;
33

4-
namespace OpenFeatureSDK.Model
4+
namespace OpenFeature.Model
55
{
66
/// <summary>
77
/// Context provided to hook execution

src/OpenFeatureSDK/Model/Metadata.cs src/OpenFeature/Model/Metadata.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
namespace OpenFeatureSDK.Model
1+
namespace OpenFeature.Model
22
{
33
/// <summary>
4-
/// <see cref="OpenFeature"/> metadata
4+
/// <see cref="Api"/> metadata
55
/// </summary>
66
public class Metadata
77
{
88
/// <summary>
9-
/// Gets name of <see cref="OpenFeature"/> instance
9+
/// Gets name of <see cref="Api"/> instance
1010
/// </summary>
1111
public string Name { get; }
1212

1313
/// <summary>
1414
/// Initializes a new instance of the <see cref="Metadata"/> class.
1515
/// </summary>
16-
/// <param name="name">Name of <see cref="OpenFeature"/> instance</param>
16+
/// <param name="name">Name of <see cref="Api"/> instance</param>
1717
public Metadata(string name)
1818
{
1919
this.Name = name;

src/OpenFeatureSDK/Model/ResolutionDetails.cs src/OpenFeature/Model/ResolutionDetails.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using OpenFeatureSDK.Constant;
1+
using OpenFeature.Constant;
22

3-
namespace OpenFeatureSDK.Model
3+
namespace OpenFeature.Model
44
{
55
/// <summary>
66
/// Defines the contract that the <see cref="FeatureProvider"/> is required to return

src/OpenFeatureSDK/Model/Structure.cs src/OpenFeature/Model/Structure.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Collections.Immutable;
44
using System.Diagnostics.CodeAnalysis;
55

6-
namespace OpenFeatureSDK.Model
6+
namespace OpenFeature.Model
77
{
88
/// <summary>
99
/// Structure represents a map of Values

src/OpenFeatureSDK/Model/StructureBuilder.cs src/OpenFeature/Model/StructureBuilder.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
using System.Collections.Immutable;
44

5-
namespace OpenFeatureSDK.Model
5+
namespace OpenFeature.Model
66
{
77
/// <summary>
88
/// A builder which allows the specification of attributes for a <see cref="Structure"/>.

src/OpenFeatureSDK/Model/Value.cs src/OpenFeature/Model/Value.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
using System.Collections.Immutable;
44

5-
namespace OpenFeatureSDK.Model
5+
namespace OpenFeature.Model
66
{
77
/// <summary>
88
/// Values serve as a return type for provider objects. Providers may deal in JSON, protobuf, XML or some other data-interchange format.

src/OpenFeatureSDK/NoOpProvider.cs src/OpenFeature/NoOpProvider.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Threading.Tasks;
2-
using OpenFeatureSDK.Constant;
3-
using OpenFeatureSDK.Model;
2+
using OpenFeature.Constant;
3+
using OpenFeature.Model;
44

5-
namespace OpenFeatureSDK
5+
namespace OpenFeature
66
{
77
internal class NoOpFeatureProvider : FeatureProvider
88
{

src/OpenFeatureSDK/OpenFeatureSDK.csproj src/OpenFeature/OpenFeature.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
5-
<RootNamespace>OpenFeatureSDK</RootNamespace>
5+
<RootNamespace>OpenFeature</RootNamespace>
66
</PropertyGroup>
77

88
<ItemGroup>
@@ -11,7 +11,7 @@
1111

1212
<ItemGroup>
1313
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
14-
<_Parameter1>OpenFeatureSDK.Tests</_Parameter1>
14+
<_Parameter1>OpenFeature.Tests</_Parameter1>
1515
</AssemblyAttribute>
1616
</ItemGroup>
1717

0 commit comments

Comments
 (0)