From c7aa503577fb090aa8af0f1a653576e1caef3197 Mon Sep 17 00:00:00 2001 From: Justin Abrahms Date: Thu, 27 Apr 2023 13:16:57 -0700 Subject: [PATCH 1/2] Spec change for named client -> provider mappings Signed-off-by: Justin Abrahms --- specification.json | 15 +++++++++++---- specification/sections/01-flag-evaluation.md | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/specification.json b/specification.json index 02a803d1..cf0e54e2 100644 --- a/specification.json +++ b/specification.json @@ -10,34 +10,41 @@ { "id": "Requirement 1.1.2", "machine_id": "requirement_1_1_2", - "content": "The `API` MUST provide a function to set the global `provider` singleton, which accepts an API-conformant `provider` implementation.", + "content": "The `API` MUST provide a function to set the default `provider`, which accepts an API-conformant `provider` implementation.", "RFC 2119 keyword": "MUST", "children": [] }, { "id": "Requirement 1.1.3", "machine_id": "requirement_1_1_3", - "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.", + "content": "The `API` MUST provide a function to bind a given `provider` to one or more client `name`s.", "RFC 2119 keyword": "MUST", "children": [] }, { "id": "Requirement 1.1.4", "machine_id": "requirement_1_1_4", - "content": "The API MUST provide a function for retrieving the metadata field of the configured `provider`.", + "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.", "RFC 2119 keyword": "MUST", "children": [] }, { "id": "Requirement 1.1.5", "machine_id": "requirement_1_1_5", - "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.", + "content": "The API MUST provide a function for retrieving the metadata field of the configured `provider`.", "RFC 2119 keyword": "MUST", "children": [] }, { "id": "Requirement 1.1.6", "machine_id": "requirement_1_1_6", + "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.", + "RFC 2119 keyword": "MUST", + "children": [] + }, + { + "id": "Requirement 1.1.7", + "machine_id": "requirement_1_1_7", "content": "The client creation function MUST NOT throw, or otherwise abnormally terminate.", "RFC 2119 keyword": "MUST NOT", "children": [] diff --git a/specification/sections/01-flag-evaluation.md b/specification/sections/01-flag-evaluation.md index d54e8379..bd419ff6 100644 --- a/specification/sections/01-flag-evaluation.md +++ b/specification/sections/01-flag-evaluation.md @@ -22,7 +22,7 @@ It's important that multiple instances of the `API` not be active, so that state #### Requirement 1.1.2 -> The `API` **MUST** provide a function to set the global `provider` singleton, which accepts an API-conformant `provider` implementation. +> The `API` **MUST** provide a function to set the default `provider`, which accepts an API-conformant `provider` implementation. ```typescript // example provider mutator @@ -33,6 +33,14 @@ See [provider](./02-providers.md) for details. #### Requirement 1.1.3 +> The `API` **MUST** provide a function to bind a given `provider` to one or more client `name`s. + +```java +OpenFeature.setProvider("client-name", new MyProvider()); +``` + +#### Requirement 1.1.4 + > 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. ```typescript @@ -42,7 +50,7 @@ OpenFeature.addHooks([new MyHook()]); See [hooks](./04-hooks.md) for details. -#### Requirement 1.1.4 +#### Requirement 1.1.5 > The API **MUST** provide a function for retrieving the metadata field of the configured `provider`. @@ -53,7 +61,7 @@ OpenFeature.getProviderMetadata(); See [provider](./02-providers.md) for details. -#### Requirement 1.1.5 +#### Requirement 1.1.6 > The `API` **MUST** provide a function for creating a `client` which accepts the following options: > @@ -68,7 +76,7 @@ OpenFeature.getClient({ The name is a logical identifier for the client. -#### Requirement 1.1.6 +#### Requirement 1.1.7 > The client creation function **MUST NOT** throw, or otherwise abnormally terminate. From 1b08e0d44eb442cb120ef1f5b4915c6e89ba9578 Mon Sep 17 00:00:00 2001 From: Justin Abrahms Date: Mon, 1 May 2023 15:09:56 -0700 Subject: [PATCH 2/2] Document rebinding & what default binding means. Signed-off-by: Justin Abrahms --- specification.json | 2 +- specification/sections/01-flag-evaluation.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/specification.json b/specification.json index cf0e54e2..2f4edfd6 100644 --- a/specification.json +++ b/specification.json @@ -17,7 +17,7 @@ { "id": "Requirement 1.1.3", "machine_id": "requirement_1_1_3", - "content": "The `API` MUST provide a function to bind a given `provider` to one or more client `name`s.", + "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.", "RFC 2119 keyword": "MUST", "children": [] }, diff --git a/specification/sections/01-flag-evaluation.md b/specification/sections/01-flag-evaluation.md index bd419ff6..c9932bb1 100644 --- a/specification/sections/01-flag-evaluation.md +++ b/specification/sections/01-flag-evaluation.md @@ -29,11 +29,13 @@ It's important that multiple instances of the `API` not be active, so that state OpenFeature.setProvider(new MyProvider()); ``` +This provider is used if there is not a more specific client name binding. (see later requirements). + See [provider](./02-providers.md) for details. #### Requirement 1.1.3 -> The `API` **MUST** provide a function to bind a given `provider` to one or more client `name`s. +> 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. ```java OpenFeature.setProvider("client-name", new MyProvider());