java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

[FEATURE] Implement domain scoping

Open beeme1mr opened this issue 1 year ago • 5 comments

Overview

A domain is an identifier that logically binds clients with providers, allowing multiple providers to be used simultaneously within a single application.

Domains were added to the spec in the following PR: https://github.com/open-feature/spec/pull/229

Tasks

### Tasks
- [ ] [Requirement 1.1.3](https://openfeature.dev/specification/sections/flag-evaluation#requirement-113): The API MUST provide a function to bind a given provider to one or more clients using a domain. If the domain already has a bound provider, it is overwritten with the new mapping.
- [ ] [Requirement 1.1.6](https://openfeature.dev/specification/sections/flag-evaluation#requirement-116): The API MUST provide a function for creating a client which accepts `domain`
- [ ] [Requirement 1.2.2](https://openfeature.dev/specification/sections/flag-evaluation#requirement-122): The client interface MUST define a metadata member or accessor, containing an immutable domain field or accessor of type string, which corresponds to the domain value supplied during client creation.
- [ ] [Requirement 3.2.2.3](https://openfeature.dev/specification/sections/evaluation-context#conditional-requirement-3223): The API MUST have a method for setting evaluation context for a domain.
- [ ] [Requirement 3.2.2.4](https://openfeature.dev/specification/sections/evaluation-context#conditional-requirement-3224): The API MUST have a mechanism to manage evaluation context for an associated domain.
- [ ] Update the `named provider` section of the readme to `domain`. See the JS SDK readme for an example: https://github.com/open-feature/js-sdk/tree/main/packages/server#domains

Reference implementations

Support was added in the JS SDK here and the Python SDK here.

[!NOTE] Some SDKs support named clients which predate domains. The domain term is intended to clarify intended behavior.

beeme1mr avatar Mar 15 '24 13:03 beeme1mr

I can pick this one up

jarebudev avatar Apr 08 '24 21:04 jarebudev

@jarebudev Feel free. This is honestly mostly done in Java, the problem is we don't use the "domain" term. Right now we use "name" or "clientName" instead... I think all the functionality is there but poorly named. For example, this method just needs it's param and doc updated (name should be domain).

If your interested in taking it on I will assign.

toddbaert avatar Apr 17 '24 15:04 toddbaert

Yeh I can work on this. When I first looked at it there didn't appear to be a huge amount of change needed for this as you say mostly a tidy-up.

jarebudev avatar Apr 28 '24 08:04 jarebudev

@jarebudev :pray: assigned

toddbaert avatar Apr 30 '24 19:04 toddbaert

as a fyi - had some other things to work on which had taken up my time. Should get a PR in this week.

jarebudev avatar May 08 '24 22:05 jarebudev