harness-community / openfeature-java-provider

Apache License 2.0
0 stars 1 forks source link

OF Requirement 1.1.1 & 1.1.2 #4

Closed scalabl3 closed 1 year ago

scalabl3 commented 1 year ago

https://docs.openfeature.dev/docs/specification/sections/flag-evaluation

Requirement 1.1.1 The API, and any state it maintains SHOULD exist as a global singleton, even in cases wherein multiple versions of the API are present at runtime.

It's important that multiple instances of the API not be active, so that state stored therein, such as the registered provider, static global evaluation context, and globally configured hooks allow the API to behave predictably. This can be difficult in some runtimes or languages, but implementors should make their best effort to ensure that only a single instance of the API is used.

Requirement 1.1.2 The API MUST provide a function to set the global provider singleton, which accepts an API-conformant provider implementation.

// example provider mutator OpenFeature.setProvider(new MyProvider());

Pseudo: OpenFeature.setProvider(new HarnessFF());