Skip to content

Commit 4cf8229

Browse files
Spec change for named client -> provider mappings (#183)
Signed-off-by: Justin Abrahms <[email protected]>
1 parent c74f409 commit 4cf8229

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

specification.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,41 @@
1010
{
1111
"id": "Requirement 1.1.2",
1212
"machine_id": "requirement_1_1_2",
13-
"content": "The `API` MUST provide a function to set the global `provider` singleton, which accepts an API-conformant `provider` implementation.",
13+
"content": "The `API` MUST provide a function to set the default `provider`, which accepts an API-conformant `provider` implementation.",
1414
"RFC 2119 keyword": "MUST",
1515
"children": []
1616
},
1717
{
1818
"id": "Requirement 1.1.3",
1919
"machine_id": "requirement_1_1_3",
20-
"content": "The `API` MUST provide a function to add `hooks` which accepts one or more API-conformant `hooks`, and appends them to the collection of any previously added hooks. When new hooks are added, previously added hooks are not removed.",
20+
"content": "The `API` MUST provide a function to bind a given `provider` to one or more client `name`s. If the client-name already has a bound provider, it is overwritten with the new mapping.",
2121
"RFC 2119 keyword": "MUST",
2222
"children": []
2323
},
2424
{
2525
"id": "Requirement 1.1.4",
2626
"machine_id": "requirement_1_1_4",
27-
"content": "The API MUST provide a function for retrieving the metadata field of the configured `provider`.",
27+
"content": "The `API` MUST provide a function to add `hooks` which accepts one or more API-conformant `hooks`, and appends them to the collection of any previously added hooks. When new hooks are added, previously added hooks are not removed.",
2828
"RFC 2119 keyword": "MUST",
2929
"children": []
3030
},
3131
{
3232
"id": "Requirement 1.1.5",
3333
"machine_id": "requirement_1_1_5",
34-
"content": "The `API` MUST provide a function for creating a `client` which accepts the following options: - name (optional): A logical string identifier for the client.",
34+
"content": "The API MUST provide a function for retrieving the metadata field of the configured `provider`.",
3535
"RFC 2119 keyword": "MUST",
3636
"children": []
3737
},
3838
{
3939
"id": "Requirement 1.1.6",
4040
"machine_id": "requirement_1_1_6",
41+
"content": "The `API` MUST provide a function for creating a `client` which accepts the following options: - name (optional): A logical string identifier for the client.",
42+
"RFC 2119 keyword": "MUST",
43+
"children": []
44+
},
45+
{
46+
"id": "Requirement 1.1.7",
47+
"machine_id": "requirement_1_1_7",
4148
"content": "The client creation function MUST NOT throw, or otherwise abnormally terminate.",
4249
"RFC 2119 keyword": "MUST NOT",
4350
"children": []

specification/sections/01-flag-evaluation.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,27 @@ It's important that multiple instances of the `API` not be active, so that state
2222

2323
#### Requirement 1.1.2
2424

25-
> The `API` **MUST** provide a function to set the global `provider` singleton, which accepts an API-conformant `provider` implementation.
25+
> The `API` **MUST** provide a function to set the default `provider`, which accepts an API-conformant `provider` implementation.
2626
2727
```typescript
2828
// example provider mutator
2929
OpenFeature.setProvider(new MyProvider());
3030
```
3131

32+
This provider is used if there is not a more specific client name binding. (see later requirements).
33+
3234
See [provider](./02-providers.md) for details.
3335

3436
#### Requirement 1.1.3
3537

38+
> The `API` **MUST** provide a function to bind a given `provider` to one or more client `name`s. If the client-name already has a bound provider, it is overwritten with the new mapping.
39+
40+
```java
41+
OpenFeature.setProvider("client-name", new MyProvider());
42+
```
43+
44+
#### Requirement 1.1.4
45+
3646
> The `API` **MUST** provide a function to add `hooks` which accepts one or more API-conformant `hooks`, and appends them to the collection of any previously added hooks. When new hooks are added, previously added hooks are not removed.
3747
3848
```typescript
@@ -42,7 +52,7 @@ OpenFeature.addHooks([new MyHook()]);
4252

4353
See [hooks](./04-hooks.md) for details.
4454

45-
#### Requirement 1.1.4
55+
#### Requirement 1.1.5
4656

4757
> The API **MUST** provide a function for retrieving the metadata field of the configured `provider`.
4858
@@ -53,7 +63,7 @@ OpenFeature.getProviderMetadata();
5363

5464
See [provider](./02-providers.md) for details.
5565

56-
#### Requirement 1.1.5
66+
#### Requirement 1.1.6
5767

5868
> The `API` **MUST** provide a function for creating a `client` which accepts the following options:
5969
>
@@ -68,7 +78,7 @@ OpenFeature.getClient({
6878

6979
The name is a logical identifier for the client.
7080

71-
#### Requirement 1.1.6
81+
#### Requirement 1.1.7
7282

7383
> The client creation function **MUST NOT** throw, or otherwise abnormally terminate.
7484

0 commit comments

Comments
 (0)