-
Notifications
You must be signed in to change notification settings - Fork 60
feat: Allow for providers with equal name in the multiprovider #1848
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| package dev.openfeature.sdk.multiprovider; | ||
|
|
||
| import dev.openfeature.sdk.Metadata; | ||
| import java.util.Map; | ||
| import java.util.List; | ||
| import lombok.Builder; | ||
| import lombok.Value; | ||
|
|
||
| /** | ||
| * Metadata for {@link MultiProvider}. | ||
| * | ||
| * <p>Contains the multiprovider's own name and a map of the original metadata from each underlying | ||
| * <p>Contains the multiprovider's own name and a list of the original metadata from each underlying | ||
| * provider. | ||
| */ | ||
| @Value | ||
| @Builder | ||
| public class MultiProviderMetadata implements Metadata { | ||
|
|
||
| String name; | ||
| Map<String, Metadata> originalMetadata; | ||
| List<Metadata> originalMetadata; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| import dev.openfeature.sdk.EvaluationContext; | ||
| import dev.openfeature.sdk.FeatureProvider; | ||
| import dev.openfeature.sdk.ProviderEvaluation; | ||
| import java.util.Map; | ||
| import java.util.List; | ||
| import java.util.function.Function; | ||
|
|
||
| /** | ||
|
|
@@ -34,7 +34,7 @@ public interface Strategy { | |
| * @return the resolved {@link ProviderEvaluation} | ||
| */ | ||
| <T> ProviderEvaluation<T> evaluate( | ||
| Map<String, FeatureProvider> providers, | ||
| List<FeatureProvider> providers, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Update the provider parameter documentation. The 🤖 Prompt for AI Agents |
||
| String key, | ||
| T defaultValue, | ||
| EvaluationContext ctx, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: open-feature/java-sdk
Length of output: 22557
Snapshot the provider list in the constructor.
MultiProviderretains the caller-supplied mutable list and passes it to strategies during evaluations. If callers mutate the list later, initialization results can diverge from lifecycle operations or evaluation behavior, and concurrent iteration can fail. Preserve duplicates and order while storing an unmodifiable defensive copy.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents