Skip to content

chore: update sdk readmes #1133

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

Merged
merged 1 commit into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Wed Apr 23 2025 08:10:40 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:04 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 Wed Apr 23 2025 08:10:40 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:05 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/technologies/client/web/angular.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 Wed Apr 23 2025 08:10:40 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:05 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
14 changes: 11 additions & 3 deletions 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 Wed Apr 23 2025 08:10:40 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:04 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down Expand Up @@ -72,7 +72,11 @@ yarn add @openfeature/web-sdk @openfeature/core
import { OpenFeature } from '@openfeature/web-sdk';

// Register your feature flag provider
await OpenFeature.setProviderAndWait(new YourProviderOfChoice());
try {
await OpenFeature.setProviderAndWait(new YourProviderOfChoice());
} catch (error) {
console.error('Failed to initialize provider:', error);
}

// create a new client
const client = OpenFeature.getClient();
Expand Down Expand Up @@ -118,7 +122,11 @@ Once you've added a provider as a dependency, it can be registered with OpenFeat
To register a provider and ensure it is ready before further actions are taken, you can use the `setProviderAndWait` method as shown below:

```ts
await OpenFeature.setProviderAndWait(new MyProvider());
try {
await OpenFeature.setProviderAndWait(new MyProvider());
} catch (error) {
console.error('Failed to initialize provider:', error);
}
```

#### Synchronous
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 Wed Apr 23 2025 08:10:40 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:04 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
56 changes: 43 additions & 13 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 Wed Apr 23 2025 08:10:39 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:03 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)
[![Specification](https://img.shields.io/static/v1?label=specification&message=v0.8.0&color=yellow&style=for-the-badge)](https://github.com/open-feature/spec/releases/tag/v0.8.0)
[
![Release](https://img.shields.io/static/v1?label=release&message=v2.4.0&color=blue&style=for-the-badge)
](https://github.com/open-feature/dotnet-sdk/releases/tag/v2.4.0)
![Release](https://img.shields.io/static/v1?label=release&message=v2.5.0&color=blue&style=for-the-badge)
](https://github.com/open-feature/dotnet-sdk/releases/tag/v2.5.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 @@ -52,7 +52,14 @@ dotnet add package OpenFeature
public async Task Example()
{
// Register your feature flag provider
await Api.Instance.SetProviderAsync(new InMemoryProvider());
try
{
await Api.Instance.SetProviderAsync(new InMemoryProvider());
}
catch (Exception ex)
{
// Log error
}

// Create a new client
FeatureClient client = Api.Instance.GetClient();
Expand All @@ -62,7 +69,7 @@ public async Task Example()

if ( v2Enabled )
{
//Do some work
// Do some work
}
}
```
Expand Down Expand Up @@ -95,9 +102,18 @@ If the provider you're looking for hasn't been created yet, see the [develop a p
Once you've added a provider as a dependency, it can be registered with OpenFeature like this:

```csharp
await Api.Instance.SetProviderAsync(new MyProvider());
try
{
await Api.Instance.SetProviderAsync(new MyProvider());
}
catch (Exception ex)
{
// Log error
}
```

When calling `SetProviderAsync` an exception may be thrown if the provider cannot be initialized. This may occur if the provider has not been configured correctly. See the documentation for the provider you are using for more information on how to configure the provider correctly.

In some situations, it may be beneficial to register multiple providers in the same application.
This is possible using [domains](#domains), which is covered in more detail below.

Expand Down Expand Up @@ -176,11 +192,18 @@ A domain is a logical identifier which can be used to associate clients with a p
If a domain has no associated provider, the default provider is used.

```csharp
// registering the default provider
await Api.Instance.SetProviderAsync(new LocalProvider());
try
{
// registering the default provider
await Api.Instance.SetProviderAsync(new LocalProvider());

// registering a provider to a domain
await Api.Instance.SetProviderAsync("clientForCache", new CachedProvider());
// registering a provider to a domain
await Api.Instance.SetProviderAsync("clientForCache", new CachedProvider());
}
catch (Exception ex)
{
// Log error
}

// a client backed by default provider
FeatureClient clientDefault = Api.Instance.GetClient();
Expand Down Expand Up @@ -223,8 +246,15 @@ EventHandlerDelegate callback = EventHandler;

var myClient = Api.Instance.GetClient("my-client");

var provider = new ExampleProvider();
await Api.Instance.SetProviderAsync(myClient.GetMetadata().Name, provider);
try
{
var provider = new ExampleProvider();
await Api.Instance.SetProviderAsync(myClient.GetMetadata().Name, provider);
}
catch (Exception ex)
{
// Log error
}

myClient.AddHandler(ProviderEventTypes.ProviderReady, callback);
```
Expand Down
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 Wed Apr 23 2025 08:10:39 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:03 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down
16 changes: 13 additions & 3 deletions 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 Wed Apr 23 2025 08:10:38 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:03 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down Expand Up @@ -96,7 +96,12 @@ public void example(){

// configure a provider
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
api.setProviderAndWait(new InMemoryProvider(myFlags));
try {
api.setProviderAndWait(new InMemoryProvider(myFlags));
} catch (Exception e) {
// handle initialization failure
e.printStackTrace();
}

// create a client
Client client = api.getClient();
Expand Down Expand Up @@ -141,7 +146,12 @@ To register a provider in a blocking manner to ensure it is ready before further

```java
OpenFeatureAPI api = OpenFeatureAPI.getInstance();
api.setProviderAndWait(new MyProvider());
try {
api.setProviderAndWait(new MyProvider());
} catch (Exception e) {
// handle initialization failure
e.printStackTrace();
}
```

#### Asynchronous
Expand Down
8 changes: 6 additions & 2 deletions 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 Wed Apr 23 2025 08:10:38 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:03 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down Expand Up @@ -72,7 +72,11 @@ yarn add @openfeature/server-sdk @openfeature/core
import { OpenFeature } from '@openfeature/server-sdk';

// Register your feature flag provider
await OpenFeature.setProviderAndWait(new YourProviderOfChoice());
try {
await OpenFeature.setProviderAndWait(new YourProviderOfChoice());
} catch (error) {
console.error('Failed to initialize provider:', error);
}

// create a new client
const client = OpenFeature.getClient();
Expand Down
28 changes: 23 additions & 5 deletions 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 Wed Apr 23 2025 08:10:39 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:03 GMT+0000 (Coordinated Universal Time)
-->

<p align="center" class="github-badges">
Expand Down Expand Up @@ -69,10 +69,10 @@ yarn add @openfeature/nestjs-sdk @openfeature/server-sdk @openfeature/core

The following list contains the peer dependencies of `@openfeature/nestjs-sdk` with its expected and compatible versions:

* `@openfeature/server-sdk`: >=1.7.5
* `@nestjs/common`: ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0
* `@nestjs/core`: ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0
* `rxjs`: ^6.0.0 || ^7.0.0 || ^8.0.0
- `@openfeature/server-sdk`: >=1.7.5
- `@nestjs/common`: ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0
- `@nestjs/core`: ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0
- `rxjs`: ^6.0.0 || ^7.0.0 || ^8.0.0

The minimum required version of `@openfeature/server-sdk` currently is `1.7.5`.

Expand Down Expand Up @@ -149,6 +149,24 @@ export class OpenFeatureTestService {
}
```

#### Managing Controller or Route Access via Feature Flags

The `RequireFlagsEnabled` decorator can be used to manage access to a controller or route based on the enabled state of a feature flag. The decorator will throw an exception if the required feature flag(s) are not enabled.

```ts
import { Controller, Get } from '@nestjs/common';
import { RequireFlagsEnabled } from '@openfeature/nestjs-sdk';

@Controller()
export class OpenFeatureController {
@RequireFlagsEnabled({ flags: [{ flagKey: 'testBooleanFlag' }] })
@Get('/welcome')
public async welcome() {
return 'Welcome to this OpenFeature-enabled NestJS app!';
}
}
```

## Module additional information

### Flag evaluation context injection
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 Wed Apr 23 2025 08:10:39 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:04 GMT+0000 (Coordinated Universal Time)
-->

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

Last updated at Wed Apr 23 2025 08:10:39 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:04 GMT+0000 (Coordinated Universal Time)
-->

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

Last updated at Wed Apr 23 2025 08:10:40 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:05 GMT+0000 (Coordinated Universal Time)
-->

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

Last updated at Wed Apr 23 2025 08:10:41 GMT+0000 (Coordinated Universal Time)
Last updated at Thu May 01 2025 08:10:05 GMT+0000 (Coordinated Universal Time)
-->

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