Skip to content

Commit

Permalink
chore: update sdk readmes (#816)
Browse files Browse the repository at this point in the history
The PR was automatically generated via the update-sdk-docs GitHub
workflow.

Signed-off-by: OpenFeature Bot <[email protected]>
  • Loading branch information
openfeaturebot authored Dec 4, 2024
1 parent dcd3017 commit 9044bc6
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 38 deletions.
2 changes: 1 addition & 1 deletion docs/reference/technologies/client/kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from kotlin-sdk.
Edits should be made here: https://github.com/open-feature/kotlin-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:25 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:02 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/client/swift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from swift-sdk.
Edits should be made here: https://github.com/open-feature/swift-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:25 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:02 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/technologies/client/web/angular.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:26 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:02 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
<a href="https://github.com/open-feature/spec/releases/tag/v0.8.0">
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge" />
</a>

<a href="https://github.com/open-feature/js-sdk/releases/tag/angular-sdk-v0.0.6-experimental">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.0.6-experimental&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/angular-sdk-v0.0.9-experimental">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v0.0.9-experimental&color=blue&style=for-the-badge" />
</a>

<br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/client/web/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:25 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:01 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/client/web/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:25 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:02 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
83 changes: 79 additions & 4 deletions docs/reference/technologies/server/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ This content has been automatically generated from dotnet-sdk.
Edits should be made here: https://github.com/open-feature/dotnet-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:25 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:01 GMT+0000 (Coordinated Universal Time)
-->

[![Specification](https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge)](https://github.com/open-feature/spec/releases/tag/v0.7.0)
[
![Release](https://img.shields.io/static/v1?label=release&message=v2.0.0&color=blue&style=for-the-badge)
](https://github.com/open-feature/dotnet-sdk/releases/tag/v2.0.0)
![Release](https://img.shields.io/static/v1?label=release&message=v2.1.0&color=blue&style=for-the-badge)
](https://github.com/open-feature/dotnet-sdk/releases/tag/v2.1.0)

[![Slack](https://img.shields.io/badge/slack-%40cncf%2Fopenfeature-brightgreen?style=flat&logo=slack)](https://cloud-native.slack.com/archives/C0344AANLA1)
[![Codecov](https://codecov.io/gh/open-feature/dotnet-sdk/branch/main/graph/badge.svg?token=MONAVJBXUJ)](https://codecov.io/gh/open-feature/dotnet-sdk)
Expand Down Expand Up @@ -80,8 +80,9 @@ public async Task Example()
| | [Eventing](#eventing) | React to state changes in the provider or flag management system. |
| | [Shutdown](#shutdown) | Gracefully clean up a provider during application shutdown. |
| | [Extending](#extending) | Extend OpenFeature with custom providers and hooks. |
| 🔬 | [DependencyInjection](#DependencyInjection) | Integrate OpenFeature with .NET's dependency injection for streamlined provider setup. |

> Implemented: ✅ | In-progress: ⚠️ | Not implemented yet: ❌
> Implemented: ✅ | In-progress: ⚠️ | Not implemented yet: ❌ | Experimental: 🔬

### Providers

Expand Down Expand Up @@ -301,3 +302,77 @@ public class MyHook : Hook

Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=hook&projects=&template=document-hook.yaml&title=%5BHook%5D%3A+) so we can add it to the docs!

### DependencyInjection
> [!NOTE]
> The OpenFeature.DependencyInjection and OpenFeature.Hosting packages are currently experimental. They streamline the integration of OpenFeature within .NET applications, allowing for seamless configuration and lifecycle management of feature flag providers using dependency injection and hosting services.
#### Installation
To set up dependency injection and hosting capabilities for OpenFeature, install the following packages:
```sh
dotnet add package OpenFeature.DependencyInjection
dotnet add package OpenFeature.Hosting
```
#### Usage Examples
For a basic configuration, you can use the InMemoryProvider. This provider is simple and well-suited for development and testing purposes.

**Basic Configuration:**
```csharp
builder.Services.AddOpenFeature(featureBuilder => {
featureBuilder
.AddHostedFeatureLifecycle() // From Hosting package
.AddContext((contextBuilder, serviceProvider) => { /* Custom context configuration */ })
.AddInMemoryProvider();
});
```
**Domain-Scoped Provider Configuration:**
<br />To set up multiple providers with a selection policy, define logic for choosing the default provider. This example designates `name1` as the default provider:
```csharp
builder.Services.AddOpenFeature(featureBuilder => {
featureBuilder
.AddHostedFeatureLifecycle()
.AddContext((contextBuilder, serviceProvider) => { /* Custom context configuration */ })
.AddInMemoryProvider("name1")
.AddInMemoryProvider("name2")
.AddPolicyName(options => {
// Custom logic to select a default provider
options.DefaultNameSelector = serviceProvider => "name1";
});
});
```
#### Creating a New Provider
To integrate a custom provider, such as InMemoryProvider, you’ll need to create a factory that builds and configures the provider. This section demonstrates how to set up InMemoryProvider as a new provider with custom configuration options.

**Configuring InMemoryProvider as a New Provider**
<br />Begin by creating a custom factory class, `InMemoryProviderFactory`, that implements `IFeatureProviderFactory`. This factory will initialize your provider with any necessary configurations.
```csharp
public class InMemoryProviderFactory : IFeatureProviderFactory
{
internal IDictionary<string, Flag>? Flags { get; set; }

public FeatureProvider Create() => new InMemoryProvider(Flags);
}
```
**Adding an Extension Method to OpenFeatureBuilder**
<br />To streamline the configuration process, add an extension method, `AddInMemoryProvider`, to `OpenFeatureBuilder`. This allows you to set up the provider with either a domain-scoped or a default configuration.

```csharp
public static partial class FeatureBuilderExtensions
{
public static OpenFeatureBuilder AddInMemoryProvider(this OpenFeatureBuilder builder, Action<IDictionary<string, Flag>>? configure = null)
=> builder.AddProvider<InMemoryProviderFactory>(factory => ConfigureFlags(factory, configure));

public static OpenFeatureBuilder AddInMemoryProvider(this OpenFeatureBuilder builder, string domain, Action<IDictionary<string, Flag>>? configure = null)
=> builder.AddProvider<InMemoryProviderFactory>(domain, factory => ConfigureFlags(factory, configure));

private static void ConfigureFlags(InMemoryProviderFactory factory, Action<IDictionary<string, Flag>>? configure)
{
if (configure == null)
return;

var flag = new Dictionary<string, Flag>();
configure.Invoke(flag);
factory.Flags = flag;
}
}
```

2 changes: 1 addition & 1 deletion docs/reference/technologies/server/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from go-sdk.
Edits should be made here: https://github.com/open-feature/go-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:25 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:01 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/java.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from java-sdk.
Edits should be made here: https://github.com/open-feature/java-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:24 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:00 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/javascript/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:24 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:01 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/javascript/nestjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This content has been automatically generated from js-sdk.
Edits should be made here: https://github.com/open-feature/js-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:25 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:01 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/server/php.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This content has been automatically generated from php-sdk.
Edits should be made here: https://github.com/open-feature/php-sdk
Once a repo has been updated, docs can be generated by running: yarn update:sdk-docs

Last updated at Mon Nov 18 2024 08:10:25 GMT+0000 (Coordinated Universal Time)
Last updated at Wed Dec 04 2024 08:10:01 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
Loading

0 comments on commit 9044bc6

Please sign in to comment.