feat(generators): expose underlying OpenFeature client on generated clients#236
feat(generators): expose underlying OpenFeature client on generated clients#236kriscoleman wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the code generation templates for Angular, C#, Go, Java, Node.js, and React to expose the underlying OpenFeature client, enabling ad-hoc flag evaluations. Review feedback identifies potential naming collisions in the Go and Node.js generators where the generic name 'client' might conflict with user-defined flags. It is recommended to use more specific identifiers, such as 'OpenFeatureClient' or 'openFeatureClient', to avoid compilation errors and ensure the generated code remains robust regardless of the flag manifest content.
…lients Allow users to access the underlying OpenFeature SDK client for ad-hoc flag evaluations beyond what is defined in the manifest. Signed-off-by: Kris Coleman <kriscodeman@gmail.com>
ad09654 to
87b6d22
Compare
|
let's drop last commit and keep with client, keep it a reserved word. We might be able to warn people if a flag matches. The real client should win out in a collision. we discussed making it optional but the conditionals would get a bit messy |
…ion warning Flag keys that transform to a reserved generator symbol (Client in Go, client in Node.js) are excluded from the generated output and a warning is emitted at generation time. Documents the reserved symbols per generator in the generators README.
87b6d22 to
cac1f24
Compare
Summary
Clientpackage-level variablereadonly client: Clientproperty onGeneratedClientinterfacegetOpenFeatureClient()method onGeneratedClientinterfacepublic IFeatureClient Clientproperty onGeneratedClientuseOpenFeatureClienthook from@openfeature/react-sdkclientgetter onGeneratedFeatureFlagServicereturning the underlyingFeatureFlagServiceself.client(no change needed)clientproperty from Node.jsGeneratedClient(no change needed)Test plan
generated.Clientaccessclient.clientfor ad-hoc evaluationsgetOpenFeatureClient()methodClientproperty accessuseOpenFeatureClientworks in a React appclientgetter works in an Angular appself.clientcontinues to work as expected